Problems with -density if -unit PixelsPerInch not specificied before input image

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
User avatar
fmw42
Posts: 24004
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problems with -density if -unit PixelsPerInch not specificied before input image

Post by fmw42 » 2018-08-16T10:35:02-07:00

I will just add a note.

Imagemagick processing is not done in the same order as typical Unix commands. Although IM 6 is forgiving in many ways, IM 7 is very strict in the order of things in the command line.

See

https://www.imagemagick.org/Usage/basics/#cmdline

and the following sections about order of the command line.

vartlok
Posts: 5
Joined: 2018-08-14T03:57:55-07:00
Authentication code: 1152

Re: Problems with -density if -unit PixelsPerInch not specificied before input image

Post by vartlok » 2018-08-17T03:39:38-07:00

I want to convert image to new image with resolution 350 and unit PixelsPerInch, but IM's converting resolution 350 -> 889 and update unit.

snibgo
Posts: 10838
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problems with -density if -unit PixelsPerInch not specificied before input image

Post by snibgo » 2018-08-17T05:21:22-07:00

Your correct command does exactly that, for me using IM v7.0.8-10:

Code: Select all

C:\www\im>%IM%magick source.jpg -units PixelsPerInch -density 350 out.jpg

C:\www\im>%IM%magick identify -verbose out.jpg
Image: out.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Mime type: image/jpeg
  Class: DirectClass
  Geometry: 562x360+0+0
  Resolution: 350x350
  Print size: 1.60571x1.02857
  Units: PixelsPerInch
snibgo's IM pages: im.snibgo.com

vartlok
Posts: 5
Joined: 2018-08-14T03:57:55-07:00
Authentication code: 1152

Re: Problems with -density if -unit PixelsPerInch not specificied before input image

Post by vartlok » 2018-08-17T07:53:08-07:00

Ah, my bad. I'm using imagemagick/7.0.8-10/bin/convert instead of imagemagick/7.0.8-10/bin/magic

Post Reply