Page 1 of 1

one-line command

Posted: 2010-04-03T01:17:56-07:00
by SPP
for example
convert a.png -options b.png
convert b.png -options2 c.png
... etc
convert y.png -options26 z.png
how to get a one-line command convert a.png -some z.png without temporary files( b.png c.png etc) ?

Re: one-line command

Posted: 2010-04-03T02:57:29-07:00
by Bonzo
You can add as many operations as you want and seperate operations with ( .. )

An example batch file:

Code: Select all

convert.exe %1 -auto-orient ( +clone -resize 900x570 -bordercolor Black -border 1x1 -font C:\Windows\Fonts\handsean.ttf -fill black -pointsize 40 -gravity southeast -annotate +13+13 "Anthony" -font C:\Windows\Fonts\handsean.ttf -fill white -pointsize 40 -gravity southeast -annotate +15+15 "Anthony" ( +clone -background black -shadow 85x5+6+6 ) +swap -background white -layers merge +repage -write "C:\Users\Anthony\Desktop\Rubble_photos\normal\%~n1.jpg" +delete ) -thumbnail 150x150 -unsharp 1.5x1+0.7+0.02 ( +clone -background black -shadow 85x3+3+3 ) +swap -background white -layers merge +repage -quality 80 "C:\Users\Anthony\Desktop\Rubble_photos\thumbs\%~n1.jpg"
Auto oriantates the image > resizes > adds a black border > font with drop shadow > adds a drop shadow to the image > saves the first image > resizes the original image > adds some sharpening > adds a drop shadow > saves the second image.

Image
Image

You probably will not get it all correct first go and so I would try doing it in steps and find any mistakes as you go.

Re: one-line command

Posted: 2010-04-03T04:04:13-07:00
by snibgo
As Bonzo says, you can just keep going.

convert a.png -options -options2 ... -options26 z.png

Two main things to remember:

1. Options like -background, -gravity and so on take default values in the multiple commands, but will "carry through" in the single command version.

2. If you use an input file more than once in a single command, you should use "-clone n" or "+clone" rather than using the file's name, so the file doesn't get re-read.