About set option

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
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

About set option

Post by adil@alfasoft.ro »

Hello,

can someone help me about how I can use an -set option:variable_name later in same command?
Ex:

convert x.jpg -trim -set option:trim_value "%@" -delete 0 y.jpg -crop "%[trim_value]" +repage y1.jpg

Nothing happen. I verified and the [trim_value] contain the correct value of trim.

Thank you.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: About set option

Post by snibgo »

"-crop" can't take an expression. Its argument must be of the form WxH+X+Y.
snibgo's IM pages: im.snibgo.com
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: About set option

Post by adil@alfasoft.ro »

Thank you, I just saw my mistake:

Now the correct comand is
convert x.jpg -set option:trim_value "%@" -delete 0 y.jpg -crop "%[trim_value]" +repage y1.jpg

The trim value have form WxH+X+Y., but it seems that crop don't want to use it. Another alternatifs?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: About set option

Post by snibgo »

It can't be an expression. It must be a literal.

You could do this as two commands in your shell. The first gets the value of "-format %@", the second uses this to crop the other image.
snibgo's IM pages: im.snibgo.com
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: About set option

Post by adil@alfasoft.ro »

I know that but my intention was to do on a single command.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: About set option

Post by snibgo »

Perhaps it can be done in one command with "-distort" and a viewport.
snibgo's IM pages: im.snibgo.com
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: About set option

Post by adil@alfasoft.ro »

Right now I found that and I think is the solution. Thank you very much.
Post Reply