Skip to content
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

Preserve the image DPI information from individual tiles in the final output #12

Open
Arekkusu1998 opened this issue Nov 21, 2019 · 11 comments
Labels
enhancement New feature or request

Comments

@Arekkusu1998
Copy link

All dezoomified maps (small and/or large) are at 96 dpi, although some are reported as 300 dpi. I did a test with this small-sized map from BNF Gallica, dezoomifying it first directly (obtaining an image at 300 dpi), then with dezoomify (obtaining an image at 96 dpi)😯. Same for other maps, not only from BNF.
This is even more true of dezoomify-rs: the large cadastral maps of Venice and Milan State Archives were uploaded at 300 dpi (archival authority confirms this fact), but are dezoomified at 96 dpi.
Why?
Are the two softwares calibrated exclusively at 96 dpi?
If so, is there a way to get the image at 300 dpi🤔?

Warning: I underline that the images to which I refer are really very large, so Photopea and Photoshop Portable freeze if I try to (re)convert them to 300 dpi.

@Arekkusu1998 Arekkusu1998 changed the title Limiti to 96 dpi both for dezoomify & dezoomify-rs? Limit to 96 dpi both for dezoomify & dezoomify-rs? Nov 21, 2019
@lovasoa
Copy link
Owner

lovasoa commented Nov 21, 2019

Hello,
The library we use to save jpeg images does not allow setting exif metadata (including DPI) on the image. Please note that the DPI is purely a meta-information, and has nothing to do with the actual quality of the image.
If you really want to set the DPI (I'd be curious to know what your use-case is), you can do it with, for instance, exiftool:

exiftool -XResolution=300 -YResolution=300 -ResolutionUnit=inches -overwrite_original your_image.jpg

A more interesting feature would be to allow the user to specify the quality parameter that is passed to the JPEG encoder for the final image creation (this feature was recently added to gapdecoder). If you are interested in that, feel free to open another issue.

@lovasoa lovasoa closed this as completed Nov 21, 2019
@lovasoa
Copy link
Owner

lovasoa commented Nov 21, 2019

If your request was indeed about DPI meta-information that is lost during dezooming and not image quality, then you can re-open this issue.

@Arekkusu1998
Copy link
Author

Arekkusu1998 commented Nov 22, 2019

Thank You very much, @lovasoa for Your promptness and for having kindly reported me about ExifTool and the system to recalibrate the parameters ...

exiftool -XResolution=300 -YResolution=300 -ResolutionUnit=inches -overwrite_original your_image.jpg

... although in substance it took almost half a day 🙄 to understand how it worked both for a single image and for a whole folder, now I know how to correct the DPI problem. Anyway, I know that DPI is a meta-info and has nothing to do with images' quality.

You also write:

If your request was indeed about DPI meta-information that is lost during dezooming and not image quality, then you can re-open this issue.

I don't know whether to do it or not: what I regret is that the original DPI.

@lovasoa
Copy link
Owner

lovasoa commented Nov 22, 2019

What exactly do you need the dpi information for ?

@Arekkusu1998
Copy link
Author

The people I work with are meticulous: if maps are available at 300 dpi, they prefer that; and, since Milan & Venice State Archives have upload them at 300 dpi, I wanted to rectify this metadata.

@lovasoa
Copy link
Owner

lovasoa commented Nov 24, 2019

Ok, I'm reopening this, then !

Currently, the libraries we use do not have support for custom DPIs, but that's changing :

@lovasoa lovasoa reopened this Nov 24, 2019
@Arekkusu1998
Copy link
Author

I'm glad to have aroused so much interest in the GitHub community, @lovasoa.
But I was wondering: since I understand very little about computer science, in the light of the threads mentioned by You above, how will dezoomify-rs change🤔? You've write that the idea to allow writing density information was accepted in image-rs/image#1078.

@lovasoa
Copy link
Owner

lovasoa commented Nov 26, 2019

dezoomify-rs uses what is called a software library to read and write JPEG files. The code of this library is not specific to dezoomify-rs, but is shared with many other projects. Once a new version of the library is released, and adds functions to read and write pixel density information, we will be able to use these functions to implement the functionality you wanted in dezoomify-rs. This may take a long time.

@Arekkusu1998
Copy link
Author

Arekkusu1998 commented Nov 26, 2019

Okay, that's fine @lovasoa: in the meantime that You experts 🧐 work on the software library, I'll use exiftool, as kindly indicated from You. Thanks and good work to everyone!

@lovasoa lovasoa added the enhancement New feature or request label Sep 1, 2020
@lovasoa lovasoa changed the title Limit to 96 dpi both for dezoomify & dezoomify-rs? Preserve the image DPI information from individual tiles in the final output Sep 1, 2020
@Boscop
Copy link

Boscop commented Nov 16, 2020

Any update on this? :)

@lovasoa
Copy link
Owner

lovasoa commented Nov 16, 2020

The image library that we use, image-rs does not have any generic support for meta-information on image files. It can write DPI information (on jpeg files only), but not read it.

@Boscop: If you want to add support for this, the work starts in these external libraries: image-rs, jpeg-decoder, and other image format libraries if we want to support this feature for them too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants