question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cropping when rotating

See original GitHub issue

Hi,

I would like to know, if it’s a bug or something I did wrong : I added today the enableOrientation: true option. Working great, the image is rotating. Yay. But I have some troubles during cropping.

In some words : I’m having an image larger than higher. When I flip it to the right, the image become higher than larger. If I try to crop the bottom of the image, the result can be transparent. And because images are always better than words :

Here the image I want to upload : croppie_1

Then I flip it croppie_2

I select the bottom of the image croppie_3

And here the result croppie_4

Am I the only one who experienced that ? Let me know if it’s not clear.

Last version of Croppie : 2.4.1 Google chrome Original dimension of the image : 1000 * 667 Viewport : 200 * 200 Boundary : 260 * 260

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:23 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
JonathonRichardsoncommented, Oct 19, 2017

I can still reproduce this with both master and the 2.5.0. It only happens with enforceBoundary disabled and an image with an aspect ratio of something other than 1:1. It looks to me like the problem is that the original image’s width and height are used during the final drawing calculation. If the image was rotated an odd multiple of 90 degrees, that means it is using the width as the height and vice versa. I’m able to fix this so far (I haven’t tested it extensively yet) by adding the following to the end of the _rotate() function to swap the original values:

if ((deg % 180) !== 0) {
    var lastOriginalHeight = this._originalImageHeight;
    this._originalImageHeight = this._originalImageWidth;
    this._originalImageWidth = lastOriginalHeight;
}

@thedustinsmith, does that seem like the right way to fix this?

6reactions
thedustinsmithcommented, Jan 9, 2018

Thanks for all the feedback in this one guys. I believe this issue is fixed in 2.5.2. I can’t recreate the issue using the rotate example in the demo page. 2.5.2 should be released soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crop rotation
Crop rotation is the practice of growing a series of different types of crops in the same area across a sequence of growing...
Read more >
Understanding Crop Rotation |The Basics and Beyond
Yet each of those favorites interact with the soil differently – and each is susceptible to particular pests and diseases. Through crop rotation ......
Read more >
Cropping and rotating images > Developing Basics
Cropping and rotating images · Click the Crop Overlay tool button just below the Histogram panel, or press the R key. · Drag...
Read more >
Cropping and Rotating Images
Exposure has tools which make cropping and rotating images quick and easy. We made this video to show you how they work.
Read more >
Cropping and rotating images - Adobe Photoshop
If you're cropping a layer (not the Background), you can click Cropped Area: Delete to delete the cropped-out areas, or click Hide to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found