After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 466372 - Add dpi support for PNG files
Add dpi support for PNG files
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2007-08-13 21:01 UTC by Ivan Baldo
Modified: 2014-10-22 15:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add PNG image density metadata support (7.05 KB, patch)
2014-10-22 14:57 UTC, Robert Ancell
accepted-commit_now Details | Review
Add PNG image density metadata support (7.04 KB, patch)
2014-10-22 14:59 UTC, Robert Ancell
accepted-commit_now Details | Review

Description Ivan Baldo 2007-08-13 21:01:35 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!
Comment 1 Bastien Nocera 2014-10-21 16:29:37 UTC
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.
Comment 2 Robert Ancell 2014-10-22 14:57:21 UTC
Created attachment 289141 [details] [review]
Add PNG image density metadata support
Comment 3 Robert Ancell 2014-10-22 14:59:43 UTC
Created attachment 289142 [details] [review]
Add PNG image density metadata support

Fix warning message
Comment 4 Bastien Nocera 2014-10-22 15:24:52 UTC
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 ?
Comment 5 Bastien Nocera 2014-10-22 15:26:33 UTC
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 ?
Comment 6 Bastien Nocera 2014-10-22 15:27:49 UTC
We have another bug about TIFF dpi, if you want to look into it, bug 498721
Comment 7 Robert Ancell 2014-10-22 15:38:52 UTC
Thanks Bastien!