Page 1 of 1
(Solved) convert -level not working properly
Posted: 2009-03-03T17:20:36-07:00
by fernandokts
When I use convert with the -level parameter, it affects everything in the command, even if I separate the other images with "\( \)"
Example:
convert \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite rose.jpg
When I use the above command, the first and the second "rose:" is affected by -level.
But when I do exactly the same thing with any other parameter, like blur, it works ok (affecting only the first "rose:").
Example:
convert \( rose: -blur 0x5 \) \( rose: \) -compose Screen -composite rose.jpg
The above command works fine. It seems to happen only with "-level"
I'm currently using ImageMagick 6.4.9-3 in linux.
Re: convert -level not working properly
Posted: 2009-03-03T18:05:59-07:00
by fmw42
see -respect-parenthesis
http://www.imagemagick.org/script/comma ... arentheses
convert -respect-parenthesis \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite rose.jpg
Re: convert -level not working properly
Posted: 2009-03-03T18:28:30-07:00
by fernandokts
It still doesn't work.
With other filters the parentheses are being respected even without "respect-parentheses".
Thank you for your reply.
Re: convert -level not working properly
Posted: 2009-03-03T19:38:38-07:00
by fmw42
fernandokts wrote:It still doesn't work.
With other filters the parentheses are being respected even without "respect-parentheses".
Thank you for your reply.
It is singular, -respect-parenthesis, not plural -respect-parentheses. Did you misspell it?
This seems to work fine for me:
convert -respect-parenthesis \( rose: -level 70,75% \) \( rose: \) +append rose_append.jpg
This also works fine for me:
convert \( rose: -level 70,75% \) \( rose: \) +append rose_append2.jpg
So might it be related to your -compose screen -composite?
see
http://www.imagemagick.org/Usage/compose/#screen to see if that is the compose setting you really want.
Re: convert -level not working properly
Posted: 2009-03-03T21:30:38-07:00
by fernandokts
Actually I used in singular, just wrote wrong in the forum.
That is really strange...
When I save an image of the "-level" command with "rose:", and then do the compose, it works. It only doesn't work when I try to do all in the same line.
convert rose: -level 70,75% rose_highcontrast.jpg
convert rose_highcontrast.jpg rose: -compose screen -composite rose_final.jpg
The above works. But I need to do it all in the same line, cause I'm making a script to do this with an image sequence. So I think, it would be faster not using a temporarily file.
Actually, It doesn't work with any other -compose mode (Plus, Multiply, etc...)
Re: convert -level not working properly
Posted: 2009-03-04T11:17:19-07:00
by fmw42
fernandokts wrote:Actually I used in singular, just wrote wrong in the forum.
That is really strange...
When I save an image of the "-level" command with "rose:", and then do the compose, it works. It only doesn't work when I try to do all in the same line.
convert rose: -level 70,75% rose_highcontrast.jpg
convert rose_highcontrast.jpg rose: -compose screen -composite rose_final.jpg
The above works. But I need to do it all in the same line, cause I'm making a script to do this with an image sequence. So I think, it would be faster not using a temporarily file.
Actually, It doesn't work with any other -compose mode (Plus, Multiply, etc...)
These all seems to work for me and produces the same result as your rose_final.jpg
convert \( rose: -level 70,75% \) rose: -compose screen -composite rose_test1.jpg
convert rose: \( +clone -level 70,75% \) -compose screen -composite rose_test2.jpg
convert rose: \( +clone -level 70,75% \) -compose lighten -composite rose_test3.jpg
convert \( rose: -level 70,75% \) miff:- | convert - rose: -compose screen -composite rose_test4.jpg
convert \( rose: -level 70,75% -write mpr:rose \) -delete 0 mpr:rose rose: -compose screen -composite rose_test5.jpg
IM 6.4.9-8 Q16 Mac OSX Tiger
Re: convert -level not working properly
Posted: 2009-03-04T19:09:14-07:00
by fernandokts
fmw42 wrote:fernandokts wrote:Actually I used in singular, just wrote wrong in the forum.
That is really strange...
When I save an image of the "-level" command with "rose:", and then do the compose, it works. It only doesn't work when I try to do all in the same line.
convert rose: -level 70,75% rose_highcontrast.jpg
convert rose_highcontrast.jpg rose: -compose screen -composite rose_final.jpg
The above works. But I need to do it all in the same line, cause I'm making a script to do this with an image sequence. So I think, it would be faster not using a temporarily file.
Actually, It doesn't work with any other -compose mode (Plus, Multiply, etc...)
These all seems to work for me and produces the same result as your rose_final.jpg
convert \( rose: -level 70,75% \) rose: -compose screen -composite rose_test1.jpg
convert rose: \( +clone -level 70,75% \) -compose screen -composite rose_test2.jpg
convert rose: \( +clone -level 70,75% \) -compose lighten -composite rose_test3.jpg
convert \( rose: -level 70,75% \) miff:- | convert - rose: -compose screen -composite rose_test4.jpg
convert \( rose: -level 70,75% -write mpr:rose \) -delete 0 mpr:rose rose: -compose screen -composite rose_test5.jpg
IM 6.4.9-8 Q16 Mac OSX Tiger
All your examples that use lighten work for me, but the ones that use screen don't.
And when I write to an image, then load it in other command with screen, it works. I will do with the lighten, that is almost the same as screen.
Thank's fmw42, for your attention and patience!
Re: convert -level not working properly
Posted: 2009-03-04T19:38:34-07:00
by anthony
fernandokts wrote:When I use convert with the -level parameter, it affects everything in the command, even if I separate the other images with "\( \)"
Example:
convert \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite rose.jpg
When I use the above command, the first and the second "rose:" is affected by -level.
when I remove the composition of the two images I see that -level was only applied to the first rose image. the second was NOT effected. Of course -screen will combine things and so a change in one rose image will effect the overall result.
Re: convert -level not working properly
Posted: 2009-03-05T10:16:10-07:00
by fernandokts
anthony wrote:
when I remove the composition of the two images I see that -level was only applied to the first rose image. the second was NOT effected. Of course -screen will combine things and so a change in one rose image will effect the overall result.
Anthony,
when you do this without the -composite, it generates two images: rose-0.jpg and rose-1.jpg.
The rose-0.jpg is the result of the first part of the command "\( rose: -level 70,75% \)" and rose-1.jpg is the result of the second part "rose:", without -composite the -compose Screen is ignored right?
So, when you type this:
convert \( rose-0.jpg \) \( rose-1.jpg \) -compose Screen -composite final.jpg
Shouldn't it be the same as:
convert \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite final.jpg
??
I'm just curious why they return different results...
Re: convert -level not working properly
Posted: 2009-03-05T10:50:58-07:00
by fmw42
All your examples that use lighten work for me, but the ones that use screen don't.
And when I write to an image, then load it in other command with screen, it works. I will do with the lighten, that is almost the same as screen.
Perhaps it is just you particular version of IM. Have you tried upgrading to the latest?
Re: convert -level not working properly
Posted: 2009-03-05T17:14:24-07:00
by anthony
Have you tried using MIFF or PNG rather than lossy JPG for intermediate results?
Re: convert -level not working properly
Posted: 2009-03-06T09:28:08-07:00
by fernandokts
fmw42 wrote:Perhaps it is just you particular version of IM. Have you tried upgrading to the latest?
You're right!
I was using 6.4.9-3, and now I'm using 6.4.9-9 from today's SVN, and it works!
anthony wrote:Have you tried using MIFF or PNG rather than lossy JPG for intermediate results?
I was using intermediate, just as an example... But I agree, the intermediate results should always use lossless formats.
Thank you all for your time!