Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing/Cropping and Appending 4 images

I'm currently using this command to resize images using imagemagick:

 convert \( ${files[0]} ${files[1]} -append \) \( ${files[2]} ${files[3]} -append \) +append $dir.jpg

enter image description here

What is the best way to deal with images which dimensions differ like in the second picture? can I specify specific width or height and make the image resize and crop to that size if its smaller and crop the center if its really hight so I always get the result like in first picture?

Thanks!

like image 257
Kristian Avatar asked Nov 12 '12 13:11

Kristian


People also ask

What is the difference between resizing and cropping an image?

Both require careful consideration as they can affect image quality. Resizing changes the dimensions of the image, which usually affects the file size (and, thereby, image quality). Cropping always involves cutting away part of the original image and results in some of the pixels being discarded.

What is the best aspect ratio to crop a photo?

Many editors provide settings for cropping to particular aspect ratios ““ the original ratio of the image, 3:2″¨4:3 and 16:9 being the most popular. The main factor to remember before you crop a digital image is that the pixels you discard cannot be restored.

What does it mean to crop an image in Photoshop?

In simple terms, cropping can be used to change the image ratio. It can also change the image size at the same time. Returning to our 10×8 print, we have two options to make the image fit on the paper. The first is to make the shortest dimension fit to the 8-inch width. 10×8 is an image ratio of 5:4.

How do you crop an image to improve the frame?

You can crop to improve the way an image is framed by excluding unwanted elements that were inadvertently (or deliberately) included. Cropping out a branch that blew into the edge of the frame while you were taking the picture is an example. 4.


1 Answers

Try to resize the image to the same size.

for i in *.jpg; do convert $i -resize 80x80 -quality 90 $i.jpg; done

Now you can append images.

Appending images before resizing

enter image description here

Appending images after resizing

enter image description here

like image 182
ymn Avatar answered Oct 02 '22 22:10

ymn