[Libreoffice-bugs] [Bug 51509] FILEOPEN: Resolution in PNG files is ignored

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jul 4 09:46:17 CEST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=51509

Roman Eisele <bugs at eikota.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |NOTOURBUG

--- Comment #4 from Roman Eisele <bugs at eikota.de> 2012-07-04 00:46:17 PDT ---
(In reply to comment #3)
> I have managed to narrow it down some more.

@Bernd Sieker:
Thank you very much for your research! Good work ...

> I attached one PNG created with convert, and one created with netpbm's
> "pnmtopng". The first does not work properly, treating it as if it were 72dpi
> (and treated the same way by Gimp, which hints at some ImageMagick problems),
> the second one works properly, although NetPBM only allows an integer value
> for "pixels per meter", which do not translate to exactly 600dpi,
> so Gimp says the image has "599.999" pixels per inch. Close enough for me.

I can confirm this, and I can also confirm that LibreOffice loads the image
file "TestPNG-600dpi-NetPBM.png" correctly with ca. 600 dpi resolution, but
treats "TestPNG-600dpi-ImageMagick.png" as a 72 dpi (default resoltion) image.

The question is now: where is the error? Who is to blame for it: ImageMagick or
LibreOffice?

Not only LibreOffice, but many applications don't understand ImageMagick's way
to set the resolution:
* Gimp 2.8.0
* PhotoShop CS (old, of course)
* Apple's Preview 5.0.3
* Scribus 1.4.1
All report that the resolution of "TestPNG-600dpi-ImageMagick.png" was 72ppi.

The only application (besides ImageMagick) I found which reads the 600ppi
resoltion from "TestPNG-600dpi-ImageMagick.png" is exiftool (8.38); when called
with
  exiftool -a -u -g1 TestPNG-600dpi-ImageMagick.png
it reports
  Pixels Per Unit X: 600
  Pixels Per Unit Y: 600
  Pixel Units      : Unknown

The last line could be the answer to our question (but I don't know for sure,
I'm no PNG file format expert): the "Unknown". It should be "Inch" instead.
When I test other valid PNG files, there is always some unit here, e.g., like
in your "TestPNG-600dpi-NetPBM.png" sample:
  Pixels Per Unit X: 23622
  Pixels Per Unit Y: 23622
  Pixel Units      : Meters
(this means ca. 600 ppi), or, from a 300ppi 24bit RGB png file saved with
PhotoShop,
  Pixels Per Unit X: 11811
  Pixels Per Unit Y: 11811
  Pixel Units      : Meters
(this means ca. 300ppi).

I don't know how these units are saved inside the PNG file format, but I get
the impression that ImageMagick is to blame for our PNG resolution problem: it
seems that ImageMagick saves the resolution in dpi correctly into PNG files,
but forgets to save the "Pixel Units" field, and therefore PNG readers just
ignore the two "Pixels Per Unit" fields, because a simple resolution number
without unit is worthless. Other image formats just use always the same unit
(e.h., dpi), but the PNG file format allows to specify the unit, and so it is
clearly an error to not specify it.

Therefore I set the status of this bug report to RESOLVED/NOTOURBUG, because it
seems that ImageMagick is to blame for this problem, which is confirmed (see
above) by the fact that even Gimp, PhotoShop, and Scribus can't read the
resolution from ImageMagick's PNG files.

Everybody, feel free to re-open this issue if you have additional evidence that
my reasoning is wrong and that there is really a problem *especially* in
LibreOffice with PNG files and resolution.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Libreoffice-bugs mailing list