[PATCH 2/9] png: use PNG_RESOLUTION_METER instead of PNG_RESOLUTION_UNKNOWN to set resolution

Adrian Johnson ajohnson at redneon.com
Wed Aug 10 02:15:24 PDT 2011


gimp does not show the correct resolution unless PNG_RESOLUTION_METER is used
---
 goo/PNGWriter.cc |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/goo/PNGWriter.cc b/goo/PNGWriter.cc
index bbe90f5..400c515 100644
--- a/goo/PNGWriter.cc
+++ b/goo/PNGWriter.cc
@@ -67,8 +67,7 @@ bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
 
 	png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
-	// PNG_RESOLUTION_UNKNOWN means dots per inch
-	png_set_pHYs(png_ptr, info_ptr, hDPI, vDPI, PNG_RESOLUTION_UNKNOWN);
+	png_set_pHYs(png_ptr, info_ptr, hDPI/0.0254, vDPI/0.0254, PNG_RESOLUTION_METER);
 
 	png_write_info(png_ptr, info_ptr);
 	if (setjmp(png_jmpbuf(png_ptr))) {
-- 
1.7.4.1


--------------010100010407070709080108
Content-Type: text/x-patch;
 name="0003-png-Add-additional-pixel-formats.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-png-Add-additional-pixel-formats.patch"



More information about the poppler mailing list