[RESOLVED]possible bug with density/units IM 6.9.10.16 Q16

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 24764
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED]possible bug with density/units IM 6.9.10.16 Q16

Post by fmw42 » 2018-12-14T13:50:08-07:00

Testing with IM 6.9.10.16 Q16 Mac OSX, I find that providing density and units for output to PNG is not working correctly. These issues go back at least as far as 6.9.8.10, which was as far back as I could go easily.

Input:
Image

Code: Select all

Image: 1.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 1000x1000+0+0
  Resolution: 39.37x39.37  <--- OK
  Print size: 25.4001x25.4001
  Units: PixelsPerCentimeter  <--- OK
  Colorspace: sRGB
  Type: PaletteAlpha
  Base type: Undefined
  Endianess: Undefined
  Depth: 8-bit

In the following, the result shows no density and units are undefined even though I supplied both.

convert 1.png -verbose -strip -resize 350x350 -quality 35 -units pixelsperinch -density 35x35 output-THDPI.png

Code: Select all

Image: output-THDPI.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 350x350+0+0
  Units: Undefined   <--- should be pixelsperinch and Resolution should be converted to those units, but no resolution shows.
  Colorspace: sRGB
  Type: PaletteAlpha
  Base type: Undefined
  Endianess: Undefined
  Depth: 8-bit

If I remove the strip, then I get Resolution and Units, but the density is not converted from pixelsperinch to pixelspercentimeter.

convert 1.png -verbose -resize 350x350 -quality 35 -units pixelsperinch -density 35x35 output-THDPI.png

Code: Select all

Image: output-THDPI.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 350x350+0+0
  Resolution: 35x35 <--- this density is wrong as it should be converted from pixelsperinch to pixelspercentimeter.
  Print size: 10x10
  Units: PixelsPerCentimeter  <---- correct units

User avatar
magick
Site Admin
Posts: 10935
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by magick » 2018-12-15T11:10:52-07:00

The -strip option is respected by the PNG coder. To override, add -define png:include-chunk=pHYs to your command line.

User avatar
fmw42
Posts: 24764
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by fmw42 » 2018-12-15T12:13:35-07:00

magick wrote:
2018-12-15T11:10:52-07:00
The -strip option is respected by the PNG coder. To override, add -define png:include-chunk=pHYs to your command line.
OK. But that does not explain why the density is not converted in value when changing between units when -strip was removed.

See my second example above.

Fred

User avatar
magick
Site Admin
Posts: 10935
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by magick » 2018-12-15T15:26:28-07:00

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.

mjamal
Posts: 62
Joined: 2017-12-27T06:13:59-07:00
Authentication code: 1152

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by mjamal » 2018-12-18T05:30:56-07:00

Is it updated yet with patch to fix this issue? I found below patch updated on Dec 17th.
ImageMagick-6.9.10-17.tar.bz2 2018-12-17 19:59 11M

mjamal
Posts: 62
Joined: 2017-12-27T06:13:59-07:00
Authentication code: 1152

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by mjamal » 2018-12-18T05:34:29-07:00

Also, is this fixed for ImageMagick 6.7.8-9 2016-06-16 (for Linux dist)?

User avatar
fmw42
Posts: 24764
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug with density/units IM 6.9.10.16 Q16

Post by fmw42 » 2018-12-28T13:31:16-07:00

This bug seems to be resolved in IM 6.9.10.17.

Contact your Linux distributions about patching to include this bug. Imagemagick has no control over Linux patches.

mjamal
Posts: 62
Joined: 2017-12-27T06:13:59-07:00
Authentication code: 1152

Re: [RESOLVED]possible bug with density/units IM 6.9.10.16 Q16

Post by mjamal » 2019-01-07T04:37:58-07:00

Our Linux Admins are having hard time installing this new ImageMagick version 6.9.10 because of too many dependencies. We have spent around 3 days finding the dependencies but stuck finally. Can you please help us regarding the dependencies? Here are the details

1) Trying to install ImageMagic 6.9.10 from below link
https://www.imagemagick.org/download/li ... x86_64.rpm
It has below dependencies
a) Requires: ImageMagick-libs(x86-64) = 6.9.10-23
b) Requires: libMagickWand-6.Q16.so.6()(64bit)
c) Requires: libMagickCore-6.Q16.so.6()(64bit)

2) For the first from above list (a), it has below dependency
libopenjp2.so.7()(64bit)
We didn't find this rpm.
3) We couldn't locate RPM for libMagickWand-6.Q16.so.6()(64bit)
4) We couldn't locate RPM for libMagickCore-6.Q16.so.6()(64bit)

We have spent around 15 days for the main issue "Image Resize via DPI for PNG image". Fred clarified the issue to you and then you guys resolved it in new version 6.9.10. We tried to search every possible source for the RPMs but couldn't make it work. Please advise.

mjamal
Posts: 62
Joined: 2017-12-27T06:13:59-07:00
Authentication code: 1152

Re: [RESOLVED]possible bug with density/units IM 6.9.10.16 Q16

Post by mjamal » 2019-01-07T04:41:21-07:00

Just to add one more thing...
We are trying to install it on CentOS 7

Post Reply