Page 1 of 1

changing DPI

Posted: 2008-05-15T07:17:13-07:00
by ewok251
Hi.

I want to change the DPI of an image, but it doesnt seem to be working.
I don't want to change the number of pixels, just the size that it's rendered at, so im using -density not -resample. However:

Code: Select all

$ identify -format "%x x %y" img_0359.jpg 
180 PixelsPerInch x 180 PixelsPerInch
$ mogrify -density 72x72 img_0359.jpg 
$ identify -format "%x x %y" img_0359.jpg 
180 PixelsPerInch x 180 PixelsPerInch
Same thing happens with 'convert' too.

The mogrify must be doing something, because if I load it into the GIMP it says the resolution is 72x72, but previewer on the Mac shows 180x180, and an 'identify -verbose' shows 180x180 and no mention of 72x72 anywhere.

Ive tried it on several images from several sources, all the same result. Ive stripped out any profile that might be used by Photoshop just in case.

Am I making some fundamental mistake?

thanks

Re: changing DPI

Posted: 2008-05-15T11:31:38-07:00
by fmw42
It works for me.

convert rose: rose.jpg
identify -format "%x x %y" rose.jpg
72 PixelsPerInch x 72 PixelsPerInch

convert rose.jpg -density 180 rose2.jpg
identify -format "%x x %y" rose2.jpg
180 PixelsPerInch x 180 PixelsPerInch

convert rose2.jpg -density 72 rose3.jpg
identify -format "%x x %y" rose3.jpg
72 PixelsPerInch x 72 PixelsPerInch

I am on IM 6.4.1-2beta Q16-hdri

Re: changing DPI

Posted: 2008-06-03T19:47:50-07:00
by anthony
Your JPG may be using photoshop densitys rather that the 'normal JPEG format density settings.

It also could be your IM is too old.

Re: changing DPI

Posted: 2008-06-04T03:50:47-07:00
by ewok251
an update on how I resolved this.. first I think I was just using a too old version of IM, but secondly, Photoshop seems to divide DPI by 10000 for some reason, so for example to get Photoshop to see 300dpi, I needed to do -density 3000000

Re: changing DPI

Posted: 2008-06-04T22:32:02-07:00
by anthony
try defining the -units setting as well as -density

Re: changing DPI

Posted: 2009-03-23T16:43:29-07:00
by anthony
What operation changes the DPI? Neither resize or crop should do this.