Jun
09
2010
0

Combining two images with ImageMagick

To combine two images of the same size with ImageMagick, you simply do the following:

The following will overlay overlay.png on top of output.png

mogrify -draw "image SrcOver 0,0 0,0 'overlay.png'" output.png

While this one will overlay overlay.png on top of input.png and save it as output.png

convert input.png -draw "image SrcOver 0,0 0,0 'overlay.png'" output.png

You can download imagemagick from http://www.imagemagick.org/

Written by John Burns in: General Randomness, PC Tips |
Jun
07
2010
0

Selective colour replacement with imagemagick

Selective colour replacement is easy from the command line with imagemagick.

You can download imagemagick from http://www.imagemagick.org/

The following will replace all red (#FF0000) pixels with blue (#0000FF)

convert sourceimage.png -fill "#FF0000" -opaque "#0000FF" destimage.png
Written by John Burns in: Uncategorized |
Jun
02
2010
0

Deleting folders recursively

I needed recursively delete folders named .svn within a directory structure.

The following will allow you dto do this from a command prompt:

FOR /F "tokens=*" %G IN ('DIR /B /AD /S .svn') DO RMDIR /S /Q %G

Remember, if you’re doing it from a batch file, you’ll need to double up the percent signs, thus:

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S .svn') DO RMDIR /S /Q %%G
Written by John Burns in: PC Tips |