-
-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rotation seems not to resize correctly #49
Comments
@speediro - I'm not sure if I understand you correctly but does this answer your question: When we were developing the rotate function there were two approaches:
The first approach is non-destructive: all of your original image is still visible but the dimensions of the image will stretch to accommodate the rotation. The second approach is destructive: the width and height of the image will not have change but after rotation some of your image will outside of the image bounds. The default behavior is 1. The way to call behavior 2 is to pass image.rotate( 13 ); // rotate by 13 degrees and resize accordingly
image.rotate( 13, false ); // rotate by 13 degrees don't resize Does that answer your issue? |
@oliver-moran - not really. |
OK. Sounds like a bug so. I'll be able to test it (and probably fix it) tonight. |
Fixed. Will do a release tonight with this fix. Thanks for spotting it. |
This is published on NPM. Thanks for spotting it. |
@oliver-moran, nice, looks like it behaves correctly now.And thanks for JIMP and the quick resolution. |
@oliver-moran , might have found another issue with rotation... var lenna = new Jimp("lenna.png", function (err) {
if (err) throw err;
this.crop(0,200,512,200).write("./output/lenna-cropped.png").rotate(33).write("./output/lenna-rotate-33.png")
}); ---edit--- var max = (this.bitmap.width > this.bitmap.height) ? this.bitmap.width : this.bitmap.height;
this.resize(max, max); to var max= Math.max(w,h,this.bitmap.width,this.bitmap.height)
this.resize(max, max); |
Nice! Yes, do a pull request and I'll pull it in. |
Bug fix rotate method #49: use max dimension
The fix for this has been pulled in. Will appear in the next release. Thanks! |
When rotating an image where the width is considerably larger than the height over an arbitrary number of degrees, JIMP returns a largely empty rotated image where the new height and width are switched and the image looks correctly rotated. I already tried just switching h and w in the advancedRotate function, but then rotate seems to crop first after this do the rotate so you end up with a cropped result anyway.
The text was updated successfully, but these errors were encountered: