Page 1 of 1

Tile same image 2x3 and save/overwrite original image

Posted: 2016-06-11T02:43:50-07:00
by Octobre
Hello
I am a new ImageMagick user. I am new on this forum and would need your help about the issue below.
I have searched the forum but have not found that same question already asked.
Thank You in advance for your insights


--
What I am trying to achieve:
I have a folder with 200 images. Many formats jpeg, png, etc
I would like to loop over them, take each image, tile that same image in a 2 columns and 3 rows format. No borders or padding around the images. As I want to keep the same filename, I want to overwrite the original image with the 2x3 “tile”.
--
I have “tried” with no success: montage -geometry +0+0 -tile 2x3 *.jpg +clone +clone +clone +clone +clone *.jpg
I do get 2x3 “tile” but not with the same image 6 times. Different images are mixed within the same “tile”


--
I am under Windows 7
--
Version I am using:
Version: ImageMagick 7.0.1-10 Q16 x64 2016-06-07 http://www.imagemagick.org
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

Re: Tile same image 2x3 and save/overwrite original image

Posted: 2016-06-11T03:37:23-07:00
by snibgo
I would do the job with one "convert" command per input image, looping through the input files in a Windows "for" command.

I wouldn't use the convert command to overwrite the images, because that can easily lead to files being processed twice. Instead, I would write outputs to a different directory. Then, delete the original files and move the new ones to that directory.

The ImageMagick convert command would be something like:

Code: Select all

convert %%F -duplicate 1 +append -duplicate 2 -append tempdir\%%F
... where %%F is the variable from the FOR loop.

Re: Tile same image 2x3 and save/overwrite original image

Posted: 2016-06-11T08:58:21-07:00
by Octobre
Hi Snibgo

Many Thanks for your help. It works. Please find below the exact command I have used in a command line windows (not in a batch file).

for /r %F in (*) do convert %~nxF -duplicate 1 +append -duplicate 2 -append sousrep\%~nxF

Thanks again and nice weekend