I have a folder with many images from different types (png, jpg, jpeg, bmp, pdf), and I would like to convert them all into png (for instance) using imagemagick.
Is there a single command which can perform this? If not, what should I do instead?
Thanks.
Try the mogrify
command:
mogrify -format png *.*
But be careful. Without the -format
option, mogrify
overwrites the original images. Make sure to read the documentation.
Although mogrify
seems to do the job, I would like to show you how this can be done with multiple commands with convert
from ImageMagick.
I think multiple commands are better, because the number of file types is supposedly quite small and you can better adjust it to your needs:
This command:
for file in *.xbm; do convert $file "`basename $file .xbm`.png"; done
will convert all .xbm
files to .png
while not touching the xbm files.
Then you can move all "converted" files:
mkdir converted for file in *.xbm; do mv $file converted/; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With