Bulk converting images from one format to another?
Solution 1:
Try these commands,
mogrify -format png /path/*.jpg
This will convert all the .jpg files into .png files and saves the converted files in the same directory.
mv /path/*.png ~/Desktop/pic
This will moves all the .png
files(converted) to the pic
directory which resides on the Desktop.
Solution 2:
Using ImageMagick.
First install imagemagick:
sudo apt-get install imagemagick
Try converting just one image at first:
convert image.jpg image.png
Now convert all:
mogrify -format png *.jpg
EDIT
You also need to split it into chunks that will fit to avoid hitting the limit of how much you can put on a command line. This should work better:
find -name '*.jpg' -print0 | xargs -0 -r mogrify -format png
The -print0
and -0
are used to handle spaces in filenames and the -r
means don't run mogrify if there's nothing to do.
Source: https://stackoverflow.com/questions/1010261/running-a-batch-with-imagemagick
EDIT 2 Switched png and jpg as per @Glutanimate's comment.
EDIT 3 Changed png to jpg in last suggestion.
Solution 3:
Firstly, convert works. You don't need to test it. Secondly, a bash oneliner suits the need:
$ for file in Ground*jpg; do { \
echo "Converting $file to `echo $file|cut -d. -f1`.png" ;\
convert $file `echo $file|cut -d. -f1`.png ; } done
Rockin' it auldskewl ;)
Cheers