Page 1 of 1

Resample JPG and PNG

Posted: 2017-11-15T07:13:50-07:00
by dp792
Hi,

For JPG and PNG, I use the command Resample to change the DPI. The original image has a size of 1920 * 1080 (96 dpi). For JPG works well. For PNG, I get the image of 15242 * 8574 (762 dpi)

Path of code:
Image. Read ("D:\artscope\96dpi\screenshots\96.png")
Image. Resample (300, 300)
Image. Write ("D:\artscope\96dpi\screenshots\96to300.png")

Command line works corrrect.
Version:ImageMagick-7.0.7-11-Q16-x86-dll

What's wrong?

Re: Resample JPG and PNG

Posted: 2017-11-15T10:05:46-07:00
by fmw42
You need to specify the units with the density. See -units. PNG only supports dots per centimeter. So the values are converted from dpi to doc. The difference is due to the units conversion. 300 dpi *2.54 cm/in = 762 dpi. Review your input and output for the units specified.

Re: Resample JPG and PNG

Posted: 2017-11-16T00:00:38-07:00
by dp792
fmw42 wrote: 2017-11-15T10:05:46-07:00 You need to specify the units with the density. See -units. PNG only supports dots per centimeter. So the values are converted from dpi to doc. The difference is due to the units conversion. 300 dpi *2.54 cm/in = 762 dpi. Review your input and output for the units specified.
Thank you for the quick and accurate answer