Hi
I'm stuck and new to this so any help is greatly appreciated. I have written a shell script to create a large number of thumbnails (png to gif). This is working but the problem is: file names are changed with the former extension added to the file name, eg. animal.png will become animal.png.gif. How do I remove the .png?
here is the script that I am using:
for img in `ls *.png`
do
convert $img -thumbnail '300x150>' thumbs/$img
done
for img in `ls thumbs/*.png`
do
convert $img -strip $img.gif
done
cheers
change names using convert on multiple files
Re: change names using convert on multiple files
found a solution that is working, added this to my script:
for f in thumbs/*.png.gif; do
base=`basename $f .png.gif`
mv -v $f thumbs/$base.gif
done
cheers,
M
for f in thumbs/*.png.gif; do
base=`basename $f .png.gif`
mv -v $f thumbs/$base.gif
done
cheers,
M
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: change names using convert on multiple files
You can also use mogrify which replaces the suffix using -format
and the path using -path.... See Im exmaples
http://www.imagemagick.org/Usage/basics/#mogrify
and the path using -path.... See Im exmaples
http://www.imagemagick.org/Usage/basics/#mogrify
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/