Problem with identify -format -append

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?".
Post Reply
blitzmailer

Problem with identify -format -append

Post by blitzmailer »

hi,
i'm Sven and my first post here.
(Sorry for my bad English, I am from German)
For weeks now I'm fighting with little problem and can not find a solution

together with "append" I put thousands of images in batch

code:
convert %xeins%.jpg %xzwei%.jpg -append C:\pics\%number%.jpg

But, I do not create If query to "identify-format" so that for example in portrait or landscape mode -append or +appened is selected

e.g -->

if height > with then
convert %xeins%.jpg %xzwei%.jpg -append C:\pics\%number%.jpg
else
convert %xeins%.jpg %xzwei%.jpg +append C:\pics\%number%.jpg
fi

.............
I have Windows Vista and i will make a .bat file for this script

It would be very happy if I could help some one!
many greetings from Germany
Sven
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Problem with identify -format -append

Post by GreenKoopa »

If I understand, this is the part you need help with?
blitzmailer wrote: if height > with then
Does this help?
identify -format "%[fx:h>w]" image.jpg
identify -format "%%[fx:h>w]" image.jpg --- (% escaped for inside batch file)

You are appending two images. The if condition will look at one image or both?
blitzmailer

Re: Problem with identify -format -append

Post by blitzmailer »

GreenKoopa wrote:If I understand, this is the part you need help with?
blitzmailer wrote: if height > with then
Does this help?
identify -format "%[fx:h>w]" image.jpg
identify -format "%%[fx:h>w]" image.jpg --- (% escaped for inside batch file)

You are appending two images. The if condition will look at one image or both?
hi Green,
thanks for your fast answer!
But still i do not understand how I can get the value of "identify" in an if and else query
e.g.

Set with = identify -format "%%[fx:h>w]" image.jpg
Set high = identify -format "%%[fx:h>w]" image.jpg
if with > high then
work-a
else
work-b
fi

........Greeting sven
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Problem with identify -format -append

Post by GreenKoopa »

blitzmailer wrote: But still i do not understand how I can get the value of "identify" in an if and else query
I was asking if my identify gave you the boolean output you needed. It compares height > width using the -fx operator. Try running it on an image.
blitzmailer wrote: Set with = identify -format "%%[fx:h>w]" image.jpg
Set high = identify -format "%%[fx:h>w]" image.jpg
So I was intending it to be more like:
Set answer = identify -format "%%[fx:h>w]" image.jpg
if answer then
...

However, I believe Windows batch files don't allow you to capture a program's output that easily. This is currently driving me crazy and so I am moving away from .bat scripts. I believe it can be done. One method uses a FOR loop. Many places on the web give examples of this, including in ImageMagick's Usage Examples:
http://www.imagemagick.org/Usage/windows/#output
You might also be able to use Set /p and use redirection to capture the output.
Post Reply