2

I would like to convert a large number of pictures in Konsole. I need pictures resized in order to make a video.

I can do it for one picture; I am satisfied with this command:

convert video000001.png -filter Lanczos -resize 50% toto000001.jpeg

So my question is how can treat the case with a lot of pictures?

2 Answers 2

2

You can do it with a simple script. Just create a folder with all the images you want to convert and launch the following script in the same folder :

img_convert.sh

#!/bin/bash 

FILES=*.png
mkdir -p ./converted
for i in $FILES 
do 
        echo "Processing image $i..." 
        /usr/bin/convert "$i" -filter Lanczos -resize 50% ./converted/converted_"$i".jpeg
done 

Edit:

@pzkpfw pointed out you can simply run this command in your shell for the same result :

for i in *.png; do convert "$i" -filter Lanczos -resize 50% converted_"$i".jpeg; done;
3
  • Why you don't use "$i" instead of $i?
    – A.B.
    Aug 4, 2015 at 8:49
  • 1
    You can also just run for i in *.png; do convert $i -filter Lanczos -resize 50% converted_$i.jpeg; straight in the bash prompt without creating a script (in the correct directory). You can also make this an alias in your .bashrc if you wish, that way you could run something like myconversion in any folder to convert all PNGs to JPEGs.
    – pzkpfw
    Aug 4, 2015 at 8:50
  • @pzkpfw That is a better solution indeed, thanks!
    – hg8
    Aug 4, 2015 at 8:58
0

Best solution, to my knowledge, is mogrify.

ImageMagick

If it's not already installed:

sudo apt-get install imagemagick

then, in the directory where your .png files are located:

mogrify -resize 50% *.png

Good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .