Page 1 of 1

Problem with identify -format -append

Posted: 2010-12-04T03:11:24-07:00
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

Re: Problem with identify -format -append

Posted: 2010-12-04T03:58:04-07:00
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?

Re: Problem with identify -format -append

Posted: 2010-12-05T06:46:26-07:00
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

Re: Problem with identify -format -append

Posted: 2010-12-05T08:55:01-07:00
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.