How to Use DENSITY setting BEFORE Vector Designation

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
jpeni
Posts: 9
Joined: 2015-01-12T14:56:33-07:00
Authentication code: 6789
Location: Uniondale NY, USA

How to Use DENSITY setting BEFORE Vector Designation

Post by jpeni »

It is recommended to use the -density option BEFORE the vector file format is specified in the command to preserve output quality. For example:

convert -density 300 "C:\Originals\File.eps" -depth 8 "C:\Previews\File.PNG"

This works for individual images, but how do you enter -depth options BEFORE specifying the vector format in the following recursive command?

FOR /R %a IN (*.eps) DO convert -depth 8 -threshold 40% -alpha off "%~a" "%~dpna.png"
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to Use DENSITY setting BEFORE Vector Designation

Post by fmw42 »

Sorry I do not use Windows so this is a guess. But you need to read the input first apart from the density and put your other arguments after reading the input.

Code: Select all

FOR /R %a IN (*.eps) DO convert -density 300 "%~a" -depth 8 -threshold 40% -alpha off  "%~dpna.png"
jpeni
Posts: 9
Joined: 2015-01-12T14:56:33-07:00
Authentication code: 6789
Location: Uniondale NY, USA

Re: How to Use DENSITY setting BEFORE Vector Designation

Post by jpeni »

Thanks for your guess, but you did not use the -density option BEFORE specifying the VECTOR format. For vector graphics, ImageMagick has both a render resolution and an output size that are independent of each other so the density must be specified BEFORE the VECTOR format.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to Use DENSITY setting BEFORE Vector Designation

Post by snibgo »

Fred's guess is correct. He had:
... convert -density 300 "%~a" ...
In the "convert" command, we specify the "-density" before reading the vector file, so the software that rasterizes the vector data will use that dpi.
snibgo's IM pages: im.snibgo.com
jpeni
Posts: 9
Joined: 2015-01-12T14:56:33-07:00
Authentication code: 6789
Location: Uniondale NY, USA

Re: How to Use DENSITY setting BEFORE Vector Designation

Post by jpeni »

Thanks. Now I recognize how Fred's placement of the "%~a" option placed the -density BEFORE the eps was specified.

Please: For those of us who need guidance - when you provide a suggested solution - please explain how your solution fixes the stated problem so we can understand.
Post Reply