Help with command line script - newb

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
LorenzoM
Posts: 1
Joined: 2017-05-24T06:24:17-07:00
Authentication code: 1151

Help with command line script - newb

Post by LorenzoM »

Hi guys, a little help here is very much appreciated.
Fred has been helping me with a script to create transparent PNGs from EPS with paths.
Which eventually contributed to a dot version upgrade to IM. :D

Well, we've successfully run the script one at a time however I need a little help with running it on all the files on a network location.
I have IM installed on my machine however every file is on a network location.

I can't seem to get the script written correctly to actually run and process all the files.
This is the working script that I can run one at a time.


convert -density 300 -profile C:\ImageMagick-6.9.8-Q16\sRGB.icc \path\to\my\file.eps -alpha transparent -clip -alpha opaque -strip \path\to\my\results\file.png


How do I write this so that I can run all EPS files in drive "M" and output to a subfolder "PNG-files" ?

This doesn't work for me:

FOR %a in (*.eps) DO convert -density 300 -profile \test-Trans-png-copy-job\sRGB.icc %a -alpha transparent -clip -alpha opaque -strip -path \PNG-files %a.png

thanks in advance
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Help with command line script - newb

Post by GeeMack »

LorenzoM wrote: 2017-05-24T07:55:41-07:00This doesn't work for me:

FOR %a in (*.eps) DO convert -density 300 -profile \test-Trans-png-copy-job\sRGB.icc %a -alpha transparent -clip -alpha opaque -strip -path \PNG-files %a.png
If you're trying to run that from a BAT script you'll need to make all those single percent signs "%" into doubles "%%".

Also, to get wildcard filenames to work you need to be running the script in the directory with the files. You can have your script change to that directory using "pushd" before the working commands.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Help with command line script - newb

Post by snibgo »

LorenzoM wrote:FOR %a in (*.eps) DO convert -density 300 -profile \test-Trans-png-copy-job\sRGB.icc %a -alpha transparent -clip -alpha opaque -strip -path \PNG-files %a.png
"-path" isn't an option for "convert". The output filename itself can contain a path.

If an input file is named "abc.eps", you will get an output file "abc.eps.png". You might prefer "abc.png", in which case you need to "%~na.png". See "help for".
snibgo's IM pages: im.snibgo.com
Post Reply