Combine/Stack image files

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine/Stack image files

Post by snibgo »

If you have spaces in your directory or filenames, you should quote the second %D, eg:

Code: Select all

for /R \mydir\images %D in (*.jpg) do identify "%D"
If that doesn't help, please copy and paste the exact command and error message here. Also, what version of IM are you running? "convert -version".
snibgo's IM pages: im.snibgo.com
Axelotl
Posts: 13
Joined: 2014-03-07T08:17:46-07:00
Authentication code: 6789

Re: Combine/Stack image files

Post by Axelotl »

Oh yeah using the quote worked perfectly.

Version: ImageMagick 6.8.8-7 Q16 x64 2014-02-13
Features: DPC Modules OpenMP

How do I -append all the images though?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine/Stack image files

Post by snibgo »

I don't know exactly what you are trying to do, or what is giving you problems. Perhaps you want something like:

Code: Select all

for /R . %D in (1.*) do (cd %~dpD & %IM%convert *.jpg -append x.png)
If you need help with Windows commands, I suggest you find a suitable forum.
snibgo's IM pages: im.snibgo.com
Axelotl
Posts: 13
Joined: 2014-03-07T08:17:46-07:00
Authentication code: 6789

Re: Combine/Stack image files

Post by Axelotl »

All I'm trying to do is -append images together.

To be very specific I have a directory with a few hundred other directories (2014-03-09 00-52-11, 2014-03-09 00-53-31, etc).
Every one of these sub-directories have different images inside them named "image.jpeg, image_001.jpeg, image_002.jpeg and image_003.jpeg".
I want an appended image to be produced for each set of images in each folder so that by the end each folder will have an appended .jpeg.
I already know how to do it with one folder at a time (using the simple convert -append command).

I did say I was new to this and I've tried to many times but with no success.

I tried that code in a few different ways but I'm not sure if I'm applying it wrong or it isn't what I'm looking for.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine/Stack image files

Post by snibgo »

The command could be something like:

Code: Select all

for /R \your\root\directory %D in (image.*) do (cd %~dpD & %IM%convert image.jpeg image_001.jpeg image_002.jpeg image_003.jpeg -append appended.jpeg)
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Combine/Stack image files

Post by fmw42 »

For new users who want to do scripting in Windows bat files, I found a few referenced that might provide useful for learning.

http://www.microsoft.com/resources/docu ... x?mfr=true
http://en.wikibooks.org/wiki/Windows_Batch_Scripting
http://www.wikihow.com/Use-the-Microsof ... e-Language
Axelotl
Posts: 13
Joined: 2014-03-07T08:17:46-07:00
Authentication code: 6789

Re: Combine/Stack image files

Post by Axelotl »

The code above just asks "More?"

Can you test it?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine/Stack image files

Post by snibgo »

I did. The command I gave, pasted into a command window, works for me (with a different directory name).
snibgo's IM pages: im.snibgo.com
Axelotl
Posts: 13
Joined: 2014-03-07T08:17:46-07:00
Authentication code: 6789

Re: Combine/Stack image files

Post by Axelotl »

Gah this is frustrating.

Here's a screenshot:

http://s11.postimg.org/w6inwxbya/screem.jpg

Bottom right is the command I used, left if the result and the rest are the directories and images.

What am I doing wrong?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine/Stack image files

Post by snibgo »

As you can see, you are not even running convert.

%IM% is the drive\directory of convert.exe. Most users choose the option at installation to put this in their system path. I don't because I need to run different versions of IM for different purposes. I should remove "%IM%" from code I put here, but I often forget. If you don't have %IM% defined, then keeping it in is harmless.

Try the following command:

Code: Select all

convert logo: x.jpeg
If this fails, then anything more complex will also fail, and I suggest you reinstall IM choosing to put the location in your system path.
snibgo's IM pages: im.snibgo.com
Axelotl
Posts: 13
Joined: 2014-03-07T08:17:46-07:00
Authentication code: 6789

Re: Combine/Stack image files

Post by Axelotl »

No way it finally worked! Thank you so much for sticking around for this long haha.

The exact code I ran was:

Code: Select all

for /R %D in (*.*) do (cd %~dpD & convert image.jpeg image_001.jpeg image_002.jpeg image_003.jpeg -append appended.jpeg
Relief.
Post Reply