I have a set of images and want to create a collage similar to this one made in Picasa
I've tried using and modifying this script but it doesn't produce similar results.
What I want the script to do is resize and crop the images to a square then arrange them randomly but in a way that allows me to specify the amount of rows and how many photos are on each row. Repetition of images isn't really a problem at this moment.
Can anyone help?
How to create collage
- hellocatfood
- Posts: 44
- Joined: 2010-01-01T13:29:41-07:00
- Authentication code: 8675309
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to create collage
Perhaps this will do what you want. Caution: this is a Windows 7 script.
Notes:
!RANDOM! will be a random integer each time it is used.
%%~nF will include the original filename (without path or extension) in case two images get the same random number.
If more than 100 input images, we will get multiple outputs.
You can change 32x32 throughout to some other rectangle. Likewise the 10x10 (columns and rows in the output).
Images won't repeat.
%IMG% points to my IM directory. Most people won't need this.
Code: Select all
set SRC=\pictures\20091205\
del *.png
for %%F in (%SRC%*.jpg) do "%IMG%convert" %%F -gamma .45455 -resize "32x32^^" -crop 32x32+0+0 +repage -gamma 2.2 !RANDOM!_%%~nF.png
"%IMG%montage" *.png -geometry 32x32+0+0 -tile 10x10 collage.jpg
!RANDOM! will be a random integer each time it is used.
%%~nF will include the original filename (without path or extension) in case two images get the same random number.
If more than 100 input images, we will get multiple outputs.
You can change 32x32 throughout to some other rectangle. Likewise the 10x10 (columns and rows in the output).
Images won't repeat.
%IMG% points to my IM directory. Most people won't need this.
snibgo's IM pages: im.snibgo.com
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to create collage
Warning. that script appears to rename images to a random number, but no check is made to prevent two images being saved to the same number!!!!!hellocatfood wrote:I've tried using and modifying this script but it doesn't produce similar results.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- hellocatfood
- Posts: 44
- Joined: 2010-01-01T13:29:41-07:00
- Authentication code: 8675309
Re: How to create collage
Thanks for that!snibgo wrote:Perhaps this will do what you want. Caution: this is a Windows 7 script.
Code: Select all
set SRC=\pictures\20091205\ del *.png for %%F in (%SRC%*.jpg) do "%IMG%convert" %%F -gamma .45455 -resize "32x32^^" -crop 32x32+0+0 +repage -gamma 2.2 !RANDOM!_%%~nF.png "%IMG%montage" *.png -geometry 32x32+0+0 -tile 10x10 collage.jpg
This code modified for Linux worked for me
Code: Select all
#!/bin/sh
for f in 'ls *.jpg' ; do convert collage_$f -resize "100x100^^" -crop 100x100+0+0 +repage %03d.png; done
montage *.png -geometry 32x32+0+0 -tile 10x10 collage.jpg