Page 1 of 1

Keep print size while converting bmp/png files

Posted: 2017-10-15T23:42:56-07:00
by yampis
Hello!

When I run program "convert in.bmp out.jpg" dpi and print sizes are modified.

For example

Image: in.bmp
Format: BMP3 (Microsoft Windows bitmap image (V3))
Class: DirectClass
Geometry: 2338x1653+0+0
Resolution: 78.34x78.34
Print size: 29.8443x21.1003
Units: PixelsPerCentimeter

Image: out.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 2338x1653+0+0
Resolution: 78x78
Print size: 29.9744x21.1923
Units: PixelsPerCentimeter

What should I do to keep exact geometry and print size?

Re: Keep print size while converting bmp/png files

Posted: 2017-10-16T11:25:16-07:00
by fmw42
This is may just be a precision issue when using identify after conversion. The Resolution may simply be rounded or truncated to an integer when showing the value in identify. The IM developers will have to comment further.

Re: Keep print size while converting bmp/png files

Posted: 2017-10-17T04:51:48-07:00
by yampis
It's not an issue in identify, because if I save bmp to jpg manually via XnView I have a difference in 4-th digit of print size.

Is there any workaround to fix print size via Imagemagick, for example:
1 - read print size from bpm
2 - convert bmp to jpg
3 - set print size to jpg without modifying pixels?

Re: Keep print size while converting bmp/png files

Posted: 2017-10-17T07:57:36-07:00
by snibgo
BMP stores resolution as an integer number of pixels per metre, eg 7834 ppm. This is equivalent to pixels per centimetre with two decimal places, eg 78.34 ppcm.

I think JPEG stores resolution as integer number of pixels per centimetre or per inch. So 78.34 ppcm will be rounded to 78 ppcm.

Re: Keep print size while converting bmp/png files

Posted: 2017-10-18T10:53:47-07:00
by yampis
Is it possible to set custom print size to jpg without modifying pixels?

Re: Keep print size while converting bmp/png files

Posted: 2017-10-18T12:05:48-07:00
by fmw42
yampis wrote: 2017-10-18T10:53:47-07:00 Is it possible to set custom print size to jpg without modifying pixels?
ImageMagick will always read the input and write the output even if just changing density.

You could use EXIFTOOL to reset the density without modifying the image pixels.