(Solved) convert -level not working properly
(Solved) convert -level not working properly
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.
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.
Last edited by fernandokts on 2009-03-10T21:05:40-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert -level not working properly
see -respect-parenthesis http://www.imagemagick.org/script/comma ... arentheses
convert -respect-parenthesis \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite rose.jpg
convert -respect-parenthesis \( rose: -level 70,75% \) \( rose: \) -compose Screen -composite rose.jpg
Re: convert -level not working properly
It still doesn't work.
With other filters the parentheses are being respected even without "respect-parentheses".
Thank you for your reply.
With other filters the parentheses are being respected even without "respect-parentheses".
Thank you for your reply.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert -level not working properly
It is singular, -respect-parenthesis, not plural -respect-parentheses. Did you misspell it?fernandokts wrote:It still doesn't work.
With other filters the parentheses are being respected even without "respect-parentheses".
Thank you for your reply.
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
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...)
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...)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert -level not working properly
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
All your examples that use lighten work for me, but the ones that use screen don't.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
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!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: convert -level not working properly
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.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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: convert -level not working properly
Anthony,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.
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...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert -level not working properly
Perhaps it is just you particular version of IM. Have you tried upgrading to the latest?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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: convert -level not working properly
Have you tried using MIFF or PNG rather than lossy JPG for intermediate results?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: convert -level not working properly
You're right!fmw42 wrote:Perhaps it is just you particular version of IM. Have you tried upgrading to the latest?
I was using 6.4.9-3, and now I'm using 6.4.9-9 from today's SVN, and it works!
I was using intermediate, just as an example... But I agree, the intermediate results should always use lossless formats.anthony wrote:Have you tried using MIFF or PNG rather than lossy JPG for intermediate results?
Thank you all for your time!