Image DPI

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
bigster
Posts: 4
Joined: 2013-08-21T02:31:25-07:00
Authentication code: 6789

Image DPI

Post by bigster »

Hi,

I´m converting an image doing the rotation of it. But when i´ve got an image with (200X252) in 96 DPI when doing the rotation (-rotate 90) the image stay with 252X200 but with 72 DPI. The image is a JPEG.

Any ideas how can i keep the same DPI for the image, but can´t do the set of the DPI directly (-density 76) because there are several images with several dimensions.

For example i´ve got an image with 300 DPI and when i do the rotation the image keep the 300 DPI, and i don´t know why.


Cheers,

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

Re: Image DPI

Post by fmw42 »

Post a link to the image that does not maintain the density? What is your IM version and platform? What version of libjpeg are you using?
bigster
Posts: 4
Joined: 2013-08-21T02:31:25-07:00
Authentication code: 6789

Re: Image DPI

Post by bigster »

Hi,

Here is the image :
Image

The version of the IM is : ImageMagick-6.8.6-Q16 (windows)

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

Re: Image DPI

Post by fmw42 »

According to IM verbose information, the image has no units defined and no specified density (resolution). EXIFtool says the resolution is 1.

So your input image in this case is not seen to have any proper density defined and thus the output after rotation will be the same.

Whatever tool you are using to look at the density is interpreting it as a default of 72 dpi when actually there is no dpi defined.

If you want the output to have some density, then you can add -units and -density before the output to make it conform.

Alternately, you can check the density (resolution) before processing each image and if there is none, then add the density (and units) you want.

see %x and %y string formats at http://www.imagemagick.org/script/escape.php
bigster
Posts: 4
Joined: 2013-08-21T02:31:25-07:00
Authentication code: 6789

Re: Image DPI

Post by bigster »

Hi,

I will try to look at the info of the original image and put the information to the new image.


Cheers,

Nuno Ferreira
Post Reply