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.
			
			
									
						
							Problems with -density if -unit PixelsPerInch not specificied before input image
Re: Problems with -density if -unit PixelsPerInch not specificied before input image
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: 12159
- 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
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
			
						Re: Problems with -density if -unit PixelsPerInch not specificied before input image
Ah, my bad. I'm using imagemagick/7.0.8-10/bin/convert instead of imagemagick/7.0.8-10/bin/magic
			
			
									
						
										
						