If they are saved in a lossy compression format (e.g. JPEG), you will either have more or less quality loss or end up with very large files. This is due to the fact, that you will have to apply a lossy compression step a second time to keep the file size reasonable. If you can live with a little quality loss and /or some increase in file size you could for example recompress the images into a new JPEG. This can be done in the shell and options for compression quality can be set.
If you have a lossless format (e.g. TIFF), there will be no problem to reencode the images.
Question - I’m almost there but I can’t seem to get the for statement working as I want it to
This is what I had written
for index in $(seq 1 2 10)
do
montage -adjoin -quality 100 -background none -geometry +0+0 $index.jpg
done
Now what happens is that if there are more than 2 images, the combined image keeps on combining the other pairs so that it has 4 images combined, and then 8 and then 12 and keeps on getting bigger and bigger
As for the for statement, what you are currently doing is repeating the montage action and adding your output file in every next iteration. This will gobble up your memory and disk space fast. Instead, the image pairs should be replacing rose: and logo: in my example and the result filename should also be changing. My bash is a little rusty so I will let someone else help you with that.
PSmagick is IM7’s convert, so if you are using IM6, do
The way you used $index makes montage only use it as a target, meaning you did not specify the source files, so montage uses all the files it finds as source and explodes when you run out of RAM. Instead, if you refer to the ridiculously long documentation I linked to in my previous post, you should specify the source files first, and the target file last. So change:
for index in $(seq 1 2 10); do
montage -adjoin -quality 100 -background none -geometry +0+0 $index.jpg
done
to
for i in {1..100..2}; do
montage -quality 92 -background white -tile 2x1 -geometry +0+0 "${i}.jpg" "$((i+1)).jpg" "output_${i}-$((i+1)).jpg"
done
There was a formatting error, you have to format code here as preformatted text. I edited the post. Please try again. You have first to “cd” into the right directory.