GNOME Bugzilla – Bug 466372
Add dpi support for PNG files
Last modified: 2014-10-22 15:38:52 UTC
I have a need to know the DPI of the image files loaded into a program since they are supposed to be scanned photos so they have a DPI put by the scanning application. I see lots of jpeg files for example that with the "identify -v" program from ImageMagick show the DPI value correctly. While I can implement a workaround in my program to try to get the DPI from JPEG and PNG files, it would be much nicer to have that capability on GdkPixbuf and could also benefit other programs. I will use it for example for a check printing application (GPL) I am doing, the user can scan a check and have that displayed as the background, then putting the text fields is a simple matter of putting them on top of the background on the fields marked on the paper. For that I need the DPI to know where the physical position is. AbiWord or GNumeric could use it too, so when someone inserts an image, they can have that image at the true physical size so when the user prints the document, the image comes out at the original physical size of the image that he scanned. What you think? Thanks for your consideration!
bug 701622 already deals with getting and setting DPI for JPEG files, so retitling. A patch and a test file would be required to move this forward.
Created attachment 289141 [details] [review] Add PNG image density metadata support
Created attachment 289142 [details] [review] Add PNG image density metadata support Fix warning message
Review of attachment 289141 [details] [review]: Looks good otherwise. ::: gdk-pixbuf/io-png.c @@ +34,1 @@ +#define DPI_TO_DPM(value) ((int) round ((value) * 1000 / 25.4)) Move to gdk-pixbuf-private.h ?
Review of attachment 289142 [details] [review]: ::: gdk-pixbuf/io-png.c @@ +34,1 @@ +#define DPI_TO_DPM(value) ((int) round ((value) * 1000 / 25.4)) Move to gdk-pixbuf-private.h ?
We have another bug about TIFF dpi, if you want to look into it, bug 498721
Thanks Bastien!