Page 1 of 1

Decrease Alpha with evaluate add doesn't work

Posted: 2015-02-10T09:27:56-07:00
by Maniac
I've got some images which have an alpha value of 240 where it should be fully opaque. Even the transparent areas should become more opaque.

For this i wanted to add 15 to the alpha channel of the whole image using convert.

I tried it with
convert --channel alpha -evaluate Add 15 +channel input.png output.png

But the alpha stays the same. If I use Multiply instead of Add it's possible to change the value with this command, but I want just Add 15 to every value.

Re: Decrease Alpha with evaluate add doesn't work

Posted: 2015-02-10T09:49:37-07:00
by snibgo
What does "convert -version" say? Probably that you are using Q16, where values go from 0 to 65535, not 0 to 255. So a 8-bit 240 becomes 240*256+240 = 61680, so you need to add 65535-61680 = 4335.

Re: Decrease Alpha with evaluate add doesn't work

Posted: 2015-02-10T11:49:01-07:00
by fmw42
You can also add by percent. So compute 100*15/quantumrange where quantumrange is 255 for Q8 IM and 655535 for Q16 IM

or get percent from

convert xc: -format "%[fx:15*100/quantumrange]" info:

Re: Decrease Alpha with evaluate add doesn't work

Posted: 2015-02-11T04:20:00-07:00
by Maniac
This is the output of the version command:

Code: Select all

Version: ImageMagick 6.7.7-10 2014-08-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
So I'm using Q16. When I add 4335 it works.