Trying to reduce the DPI of a image

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
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Trying to reduce the DPI of a image

Post by helloworld »

Hello,

I am trying to reduce DPI of a image from 300 to 72 by using the below command, for some reason when i go and look at the result image its still showing me the 300 DPI.

command : convert image -density 72 -units pixelsperinch resultimage

Can you help me out.
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Re: Trying to reduce the DPI of a image

Post by helloworld »

I am using,

Version: ImageMagick 6.8.8-2 Q16 x86_64 2014-01-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff x xml zlib
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to reduce the DPI of a image

Post by snibgo »

It works fine for me, v6.8.8-0, using png files. What file types are you using?
snibgo's IM pages: im.snibgo.com
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Re: Trying to reduce the DPI of a image

Post by helloworld »

I am using jpg image files. and i am on version 6.8.8-2
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Trying to reduce the DPI of a image

Post by fmw42 »

try

Code: Select all

convert image.jpg -units pixelsperinch -density 72x72 resultimage.jpg
Does that work. Note there was an old bug that I recall where the units needed to be specified first. Though I expect that has been fixed.

Can you post a link to your input image? You can upload to some free image hosting, such as drop box (public folder) and put a link here. If not, the please provide the results of

identify -verbose yourimage.jpg

and use the code button above to enclose in code tags so that it more readable.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to reduce the DPI of a image

Post by snibgo »

It works for me:

Code: Select all

convert -size 100x100 xc: -density 300 x.jpg

identify -verbose x.jpg

  Resolution: 300x300

convert x.jpg -density 72 y.jpg

identify -verbose y.jpg

  Resolution: 72x72
What are your exact commands?
snibgo's IM pages: im.snibgo.com
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Re: Trying to reduce the DPI of a image

Post by helloworld »

I tried the commandconvert image.jpg -units pixelsperinch -density 72x72 resultimage.jpg which you gave but still it did not worked for me.

Here is the link for the input image https://app.box.com/s/f77vaznl5ijxm60qt1kq
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Re: Trying to reduce the DPI of a image

Post by helloworld »

Looks like the issue is fixed.

After changing the DPI i am checking it in adobe photoshop, for some reason my photoshop is fixed to 300 PPI by default and now i verified via Preview app in MAC and through identify and now its showing me the correct Resolution.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to reduce the DPI of a image

Post by snibgo »

It converts fine for me, using "identify" to see the new density.

What tool are you using? Some tools (eg Photoshop) may also bury the density in another field that isn't changed by IM.

Incidentally, I would never use IM to change the metadata of a JPEG. IM will read the image and re-compress it for the writing. This is always lossy for JPEG. Exiftool is a better tool for changing metadata.

EDIT: cross-posted with you.
snibgo's IM pages: im.snibgo.com
helloworld
Posts: 69
Joined: 2013-05-22T09:42:33-07:00
Authentication code: 6789

Re: Trying to reduce the DPI of a image

Post by helloworld »

It works fine for me now.

After changing the DPI i am checking it in adobe photoshop, for some reason my photoshop is fixed to 300 PPI by default and now i verified via Preview app in MAC and through identify and now its showing me the correct Resolution.
Post Reply