PNG Image 72 DPI to 300 DPI convertion

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
srisakthikrishnan
Posts: 2
Joined: 2013-03-19T09:27:41-07:00
Authentication code: 6789

PNG Image 72 DPI to 300 DPI convertion

Post by srisakthikrishnan »

Hi
I have PNG images of dimension 3600 X 3600 with 72 DPI and transparent background . I'm trying to change the DPI to 300. I tried below commands but its not working at all

convert Img1.png -strip -units "PixelsPerCentimeter" -density 300 Img2.png
convert Img1.png -resample 300 Img2.png

I tried my best but not able to find any solution. The same command is working fine if I convert the image form PNG to JPG or some other format.
can any one please help me with this.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG Image 72 DPI to 300 DPI convertion

Post by fmw42 »

PNG does not support units of pixels-per-inch. IM will automatically convert it to the corresponding pixels-per-centimeter. Note 2.54cm per inch is the conversion.

You have told it in the first command to convert to 300 dots per centimeter. DPI is dots per inch
srisakthikrishnan
Posts: 2
Joined: 2013-03-19T09:27:41-07:00
Authentication code: 6789

Re: PNG Image 72 DPI to 300 DPI convertion

Post by srisakthikrishnan »

Thanks.
I changed my command as convert "D:\1.png" -units "PixelsPerCentimeter" -strip -density 118.12 "D:\2.png" .
This works fine in my local system(Windows 7 64 bit ) but not in Win Server 2003. I'm using ImageMagick-6.4.1-Q16 both in local and server.

I'm invoking the command from ASP.Net page.When I tried the command in server I'm not getting any error messages but its working fine when invoked from local system using Visual Studio.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG Image 72 DPI to 300 DPI convertion

Post by fmw42 »

Perhaps differences in IM versions. 6.4 is very ancient. IM is not at 6.8 so about 400 versions old
Post Reply