Monday, January 25, 2010

Useful PNG commands

Useful command for handling PNG files.

Prerequisites: ImageMagick, Pngcrush

Resizing

Resize to a given maximum size

for i in *png ; do convert $i -geometry 16x16 x/$i; done

Resize exactly to given size, adding transparent borders

for f in $(for i in x/* ; do file $i | grep -v '16 x 16' | cut -d: -f1; done) ; 
  do convert $f -type TrueColorMatte -compose Src -gravity center -extent 16x16 y/$f ; 
done

Optimizing

Trying different PNG compression settings, removing extra PNG contents (such as comments)

for i in y/*png ; do pngcrush  -rem alla -reduce -brute "$i" z/"$i"; done

1 comment:

  1. With the 4K screen, fc2 you will certainly take pleasure Android TV Box in playing a large range of video games Get brand new Android TV Box that you will certainly like. Best Android TV Box Get started with it today go to website as well as you will recognize

    ReplyDelete