-density not working properly

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
Andon

-density not working properly

Post by Andon »

I am not sure if I'm doing something wrong or if ImageMagick is borked, but regardless of how I use the -density command, it doesn't seem to work properly.

Using the following:

Code: Select all

convert -size 1006x720 xc:transparent -pointsize 16 -density 290.286 -draw "text  35,70 'test'" test_text.png
produces text of the proper size and an image of the proper size, but when I open the image in GIMP, it reads it as 72 DPI.

Is this something my end?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: -density not working properly

Post by el_supremo »

I tried your command and then did:

Code: Select all

identify -verbose test_text.png
which reports, amongst other things:

Code: Select all

  Resolution: 290x290
  Units: Undefined
If you mean pixels per inch you should do:

Code: Select all

convert -size 1006x720 xc:transparent -pointsize 16 -units pixelsperinch -density 290.286 -draw "text  35,70 'test'" test_text.png
but note that the PNG specification only allows for pixels per centimetre and IM will convert 290.286 ppi to 114.28 ppcm.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Andon

Re: -density not working properly

Post by Andon »

Alright, thanks. I was looking through the documentation - not really reading too much - and there was no -units thing that I had seen, so I just figured that it was just ppi. I'd actually prefer to use ppcm - so rather than -units pixelsperinch it'd be -units pixelspercentimeter ?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: -density not working properly

Post by el_supremo »

so rather than -units pixelsperinch it'd be -units pixelspercentimeter ?
Yes.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -density not working properly

Post by fmw42 »

Andon

Re: -density not working properly

Post by Andon »

Awesome guys. Got around to doing this just now, and it works perfectly. Thanks a lot
Post Reply