Page 1 of 1

Help with command line script - newb

Posted: 2017-05-24T07:55:41-07:00
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

Re: Help with command line script - newb

Posted: 2017-05-24T08:00:53-07:00
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.

Re: Help with command line script - newb

Posted: 2017-05-24T08:54:57-07:00
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".