Is ImageMagick calculate DPI of an image correctly for all format images like (jpeg, tiff, bmp)?
May I increase/decrease DPI of an image through ImageMagick?
in this command
identify -verbose some_image.jpg
In the output where is DPI?
Determining DPI through ImageMagick
Re: Determining DPI through ImageMagick
Hi Buddies
I found the solution...
identify -format "%w x %h %x x %y" image.jpg
216 x 144 72 PixelsPerInch x 72 PixelsPerInch
Adjust the DPI:
convert image.jpg -units "PixelsPerInch" -density 300 -resample "300x" image300.jpg
Check the properties of the new file:
identify -format "%w x %h %x x %y" image300.jpg
216 x 144 300 PixelsPerInch x 300 PixelsPerInch
It works fine for me.
I found the solution...
identify -format "%w x %h %x x %y" image.jpg
216 x 144 72 PixelsPerInch x 72 PixelsPerInch
Adjust the DPI:
convert image.jpg -units "PixelsPerInch" -density 300 -resample "300x" image300.jpg
Check the properties of the new file:
identify -format "%w x %h %x x %y" image300.jpg
216 x 144 300 PixelsPerInch x 300 PixelsPerInch
It works fine for me.
Re: Determining DPI through ImageMagick
When you first change the density manually to 300dpi, you don't need the "-resample". 

Re: Determining DPI through ImageMagick
Thanks but can you tell me will it effect the quality of image in printing..?
Re: Determining DPI through ImageMagick
What is "it"?ziasumo wrote:Thanks but can you tell me will it effect the quality of image in printing..?
- In your example, the resample does simply nothing.
- Changing the density doesn't alter the quality of the image (the pixels) itself - but it will change the print size. When you change the density of a file from 72 to 300 dpi, it will usually be printed at a smaller size - if that's what you want. (The print could 'look' better if it's on a smaller size.)
- Changing the density with ImageMagick and storing it as JPG does affect/reduce the quality of the image - as it has to recompress the file (but the difference will usually be very small).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Determining DPI through ImageMagick
For all the details abour image density or resolution in ImageMagick see..
Basics, Image Density or Resolution
http://www.imagemagick.org/Usage/basics/#density
Resizing images, Resample - Changing an image's resolution
http://www.imagemagick.org/Usage/resize/#resample
Basics, Image Density or Resolution
http://www.imagemagick.org/Usage/basics/#density
Resizing images, Resample - Changing an image's resolution
http://www.imagemagick.org/Usage/resize/#resample
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/