Page 1 of 1

About set option

Posted: 2015-10-27T02:58:37-07:00
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.

Re: About set option

Posted: 2015-10-27T03:05:33-07:00
by snibgo
"-crop" can't take an expression. Its argument must be of the form WxH+X+Y.

Re: About set option

Posted: 2015-10-27T03:08:24-07:00
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?

Re: About set option

Posted: 2015-10-27T03:45:45-07:00
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.

Re: About set option

Posted: 2015-10-27T04:01:08-07:00
by adil@alfasoft.ro
I know that but my intention was to do on a single command.

Re: About set option

Posted: 2015-10-27T04:10:01-07:00
by snibgo
Perhaps it can be done in one command with "-distort" and a viewport.

Re: About set option

Posted: 2015-10-27T04:22:32-07:00
by adil@alfasoft.ro
Right now I found that and I think is the solution. Thank you very much.