coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.14k stars 784 forks source link

Does this library enable the setting of a DPI #128

Closed JimTyrrell closed 4 years ago

JimTyrrell commented 6 years ago

Expected behavior

It would be lovely if this library could set the DPI of the underlying image that is created.

Actual behavior

I have some code I could contribute if you can guide me where it should go.

Steps to reproduce the behavior

Doesn't seem to be documented.

Environment

All

coobird commented 6 years ago

What do you exactly mean by setting the DPI of the underlying image? Are you referring to the metadata that's included in the thumbnails that are produced by Thumbnailator?

Thumbnailator is a library that deals with pixel-level manipulation of images. In order to talk about DPI (i.e. dots-per-inch, where inch is a real world quantity of measurement), we would have to talk about real world measurement units when defining how to process the image. That's not in the scope of what Thumbnailator was designed to do.

If what you're trying to do is have a way to easily say, "change the DPI of an image from 96 DPI to 144 DPI", then for example, if the pixel dimensions of an image that's 1 inch x 1 inch image at 96 DPI, when changed to 144 DPI, you'd have to do the calculations outside of Thumbnailator, and give it the size in pixels.

coobird commented 4 years ago

No reply to follow-up for almost 2 years.