ppi get rounded

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

ppi get rounded

Post by Lars-Daniel »

Hi there,

I've got a TIFF file coming from Photoshop CC 2015. It has 3991 x 3991 px. Since it should be printed at 550 x 550 mm, Photoshop has the ppi to 184.30 in EXIF. I'm using this to convert the TIFF to PDF with JPEG-compression:

Code: Select all

convert2 -strip -interlace Plane -define jpeg:dct-method=float -quality 85 source.tif result.tif
After this, the JPEG's ppi got set to 184 ... seems like some rounding is done. Is this a bug?
My version installed: ImageMagick 6.9.1-3 Q16 i686 2015-07-01 http://www.imagemagick.org

Is there a work-around always to auto-set the ppi (no resizing etc.) to make it fit to 550 x 500 mm ?

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

Re: ppi get rounded

Post by fmw42 »

How are you determining the IM density? If using identify -verbose, perhaps that is just an IM readout that is truncated, but the image may have the proper density. Try using EXIFTOOL to see the actual density.

Also what platform are you on?

If you post your image to dropbox.com and put the URL here, some one can verify the proper density.
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

fmw42 wrote:How are you determining the IM density? If using identify -verbose, perhaps that is just an IM readout that is truncated, but the image may have the proper density. Try using EXIFTOOL to see the actual density..
identify tells me for the source:
Geometry: 3991x3991+0+0
Resolution: 184.302x184.302
Print size: 21.6547x21.6547
EXIFTOOL, Photoshop, IrfanView and identify tell me for the result:
Geometry: 3991x3991+0+0
Resolution: 184x184
Print size: 21.6902x21.6902
fmw42 wrote:Also what platform are you on?
Windows, but it 's the cygwin build. On my Debian Jessie, I'm getting the same results.
fmw42 wrote:If you post your image to dropbox.com and put the URL here, some one can verify the proper density.
I can't. It's a HQ scan of fine art. An artist draw it some weeks ago and it's fully protected by copyright. Maybe I can do the same with an empty image. Let me test.
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

Yeah, seems to be a bug! I can reproduce it with a small test file: http://ge.tt/api/1/files/6vkw3vO2/0/blob?download

Code: Select all

convert -strip -interlace Plane -define jpeg:dct-method=float -quality 85 test.tif result.jpg
source:
Geometry: 800x800+0+0
Resolution: 36.945x36.945
Print size: 21.6538x21.6538
Units: PixelsPerInch
result:
Geometry: 800x800+0+0
Resolution: 37x37
Print size: 21.6216x21.6216
Units: PixelsPerInch
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ppi get rounded

Post by snibgo »

TIFF works fine for me:

Code: Select all

f:\web\im>%IM%convert rose: -density 123.456 -units PixelsPerInch r.tiff

f:\web\im>%IM%convert r.tiff -strip r2.tiff

f:\web\im>%IM%identify -verbose r2.tiff | grep Resolution
  Resolution: 123.456x123.456
But JPG is integer only:

Code: Select all

f:\web\im>%IM%convert rose: -density 123.456 -units PixelsPerInch r.jpg

f:\web\im>%IM%identify -verbose r.jpg | grep Resolution
  Resolution: 123x123
I don't know if this is an IM bug, or a limitation of JPG.
snibgo's IM pages: im.snibgo.com
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

snibgo wrote:I don't know if this is an IM bug, or a limitation of JPG.
JFIF APP0 marker segment has 2 bytes for Xdensity/Ydensity density - is this important ?
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

I've created a JPEG in Photoshop with resolution 12.3 x 12.3. Identify does recognize this correctly. But I think, EXIF is used to store the correct size.
Edit: EXIF with XResolution/YResolution is needed to make float work...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ppi get rounded

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.9.2-4 Beta, available by sometime tomorrow. Thanks.
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

magick wrote:We can reproduce the problem you posted and have a patch in ImageMagick 6.9.2-4 Beta, available by sometime tomorrow. Thanks.
ImageMagick v7.0.2-9 Q16 x64 2016-08-14 still has this problem :(
Lars-Daniel
Posts: 37
Joined: 2015-09-20T05:55:17-07:00
Authentication code: 1151

Re: ppi get rounded

Post by Lars-Daniel »

This bug still has NOT been fixed.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ppi get rounded

Post by fmw42 »

Lars-Daniel wrote:This bug still has NOT been fixed.
In what version of IM? If not fixed in the most current version, then you should report this on the Bugs forum.
Post Reply