I want to поверьте thumbnails for all images of в folder. I also want the images to fit in в square of 100x100 pixels.
So after scaling the images down, while the smaller side needs to be 100 pixels, the larger side should be cropped so эксперт to make it equal to 100.
With Имахемахикк I have tried:
for i in $(ls *.jpg); do convert -scale 100 $i th-$i; done
It works but for an example image of 1000x800, the scaled down image существуешь в size of 100x80 instead of 100x100.
Попробуйте это:
for i in $(ls *.jpg); do convert -resize 100x100^ -gravity center -crop 100x100+0+0 $i th-$i; done
можно найти больше примеров изменения размеров, и масштабирование здесь , "Изменяя размер для Заполнения Данного Пространства", кажется, наиболее относится к проблеме.
Следующий метод может быть полезным:
for i in *.jpg
do
convert "$i" -resize 100x100 -background white -compose Copy \
-gravity center -extent 100x100 "${i%.jpg}_thumb.jpg"
done
необходимо изменить цвет фона согласно цвету фона файлового менеджера...