Operating Systems > Linux and UNIX
Batch png resizing
KernelPanic:
I have about 20 png's that I need to resize a little smaller.
Just wondering what program would I use to shrink them and how would I put that into a bash script?
flap:
convert.
Do you want them resized to a particular size or % of their current size?
KernelPanic:
I have a particular size I need them to be (the same for all of them)
flap:
If they're all in one directory, this will create smaller versions of the pngs but leave the original files:
for i in *.png; do convert "$i" -resize 50x50 "small$i"; done
Change the 50x50 to whatever dimensions you want, and "small$i" to the output filename you want (this will just prepend "small" to the start of the original filename)
Or, if you don't want to keep the original files, this will overwrite them with the smaller ones:
for i in *.png; do convert "$i" -resize 50x50 temp.png; mv temp.png "$i"; done
KernelPanic:
Thanking you very much!
Navigation
[0] Message Index
[#] Next page
Go to full version