-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DPI changes from 72 to 25 #96
Comments
Hi Jérôme, 72 pixels/inch is often used as a "default" value that can also represent "has not been set", which seems to be the case with your original image.
libvips defaults to 1000 pixels/m if the input image is missing the unit type. 1000 pixels/m = 10 pixels/cm = 25 pixels/inch.
What's the source of your original image? |
Images are output of https://github.com/imagemin/imagemin with the optipng plugin https://github.com/imagemin/imagemin-optipng |
Out of curiosity, when putting that 25DPI as value, does that mean that the quality of the picture has been reduced? Or it's just some arbitrary value that has no impact on picture quality? |
I believe it's an arbitrary value - at worst it might affect the resolution if printed. |
Hi, I've changed the vips default to 72 dpi, as you suggested. Thanks! |
Thank you @jcupitt ! |
...and thank you @jeromegv for reporting this in the first place. |
So, the images that I'm producing will be printed. =) |
I used to work in the printing business. DPI is very confusing and mostly useless. A wise old print expert told me it was more helpful to think in terms of PPI, "pixels per printed inch". Suppose you are going to be printing an area 10 inches across and you have a 3000 x 2000 pixel image. You'll get 3000 / 10 == 300 pixels for every printed inch, or 300 PPI. The rule of thumb would be: >=300 is usually enough, but you can get away with less under some circumstances. The idea is that to work out the PPI you must know how many pixels you have and what distance you intend to print over. The DPI tag on images is missing both bits of information. It's a hint about the size the creator intended you to print at, but (confusingly) you can't calculate the resolution you'll actually get when you print at some other output size. An image tagged as "300 dpi" could have great quality or terrible quality when you print it. |
Hi!
I've noticed that whenever I resize a PNG, the output file changes from 72 DPI to 25DPI
Is that normal?
Here's a picture before the resize
https://socialenterprise.s3.amazonaws.com/logos/bayani-brew-Bayani-Brew-Logo-small.png
And here's the picture after the resize
https://socialenterprise.s3.amazonaws.com/logos/thumbnail_bayani-brew-Bayani-Brew-Logo-small.png
I use:
sharp(filePath).resize(240,240).max().quality(90).toBuffer(function(err, buffer) {
fs.writeFileSync('out.jpg', buffer);
});
I do not have an issue with JPG
Thanks for your help
The text was updated successfully, but these errors were encountered: