Comments (9)
@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:
- We could rotate and resize the image accordingly
- We could rotate the image but not resize it
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 false
as a second argument to the rotate method:
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?
from jimp.
@oliver-moran - not really.
The examples I posted show the result I get when doing the first.
As you can see, it does not really keep everything of the image. It created a very high image yet rotates over the correct angle.
Can you try my code with the first image I posted?
You should get the second image...
from jimp.
OK. Sounds like a bug so.
I'll be able to test it (and probably fix it) tonight.
from jimp.
Fixed. Will do a release tonight with this fix. Thanks for spotting it.
from jimp.
This is published on NPM. Thanks for spotting it.
from jimp.
@oliver-moran, nice, looks like it behaves correctly now.And thanks for JIMP and the quick resolution.
from jimp.
@oliver-moran , might have found another issue with rotation...
Can you check the following test? Is it possible that there are remnants of the first blitting op?
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---
I think I found the issue... I changed (still new at git, is it a pull request I have to create?)
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);
from jimp.
Nice! Yes, do a pull request and I'll pull it in.
from jimp.
The fix for this has been pulled in. Will appear in the next release. Thanks!
from jimp.
Related Issues (20)
- process image HOT 1
- Converted .BMP to .JPG has repeated edges
- unrecognised content at end of stream
- Suggest adding Otsu's threshold algorithm
- No matter what, "Mime must be a string"
- Error reading arraybuffer in production environment HOT 1
- Share some examples of how to use it.(Multi page tiff from multiple images)
- @jimp/png won't work with @jimp/custom
- .brightness() method does not affect brightness
- Upgrade dependancy version of xml2js HOT 1
- Save to specific width and height in inches HOT 1
- Jimp.decoders is undefined in browser with webpack and typescript
- ERR_PNPM_NO_MATCHING_VERSION No matching version found for @jimp/plugin-scale@^0.22.12
- zlib_bindings problem when used in Vite with Typescript
- Do anyone can run jimp in latest reactjs project? HOT 1
- Unable to get it working in a Vue project. HOT 3
- [BUG] Error when using ES Modules with Jimp HOT 6
- Cannot load fonts in Web Worker
- Japanese characters not able to write and render image
- Unable to install jimp library through npm bcz of vulnerabilities checks HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jimp.