Resample JPG and PNG

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
dp792
Posts: 2
Joined: 2017-11-15T06:58:22-07:00
Authentication code: 1152

Resample JPG and PNG

Post by dp792 » 2017-11-15T07:13:50-07:00

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?

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

Re: Resample JPG and PNG

Post by fmw42 » 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.

dp792
Posts: 2
Joined: 2017-11-15T06:58:22-07:00
Authentication code: 1152

Re: Resample JPG and PNG

Post by dp792 » 2017-11-16T00:00:38-07:00

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

Post Reply