JMagick: levels not working properly

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
amit1411
Posts: 8
Joined: 2015-08-03T22:24:14-07:00
Authentication code: 1151

JMagick: levels not working properly

Post by amit1411 »

Hello,

I am working on an Android app, where I need to apply levels to an image via JMagick. JMagick API levelImage takes one string as an argument. Since we need to provide black point, midpoint and white point, could someone please help on how it needs to be provided?

I tried some options with comma separated values like "0%,15%,1", "0,217,1" but did not get expected results.

Thanks for the help.
Regards,
Amit
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JMagick: levels not working properly

Post by fmw42 »

I do not know about JMagick, but only one set of triplets can be used, such as 0%,95%,1 which would not change black, reduce white to gray(95%) and not change the midvalue (gamma), since its value is 1. The percents are not clip percents in counts but percentage graylevels where 0% is black and 100% is white. See http://www.imagemagick.org/script/comma ... .php#level
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JMagick: levels not working properly

Post by fmw42 »

According to http://www.jmagick.org/jmagick-doc/, the order appears to be black, mid, and white.

So just a guess; "0% 1 85%" or perhaps it only works with quantumrange values. So if your Qlevel is Q16, then the range is 0 to 65535. So 8% of 65535 would be 55705, so "0 1 55705". Not sure if you need comma separators or not, since I do not use Jmagick
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JMagick: levels not working properly

Post by fmw42 »

P.S. I do not believe JMagick is a product developed or maintained by Imagemagick. So you may be better to ask your question on JMagick forum or to the JMagick web site (listed) in my previous email. Perhaps someone who knows coding can decipher the code for how the arguments need to be expressed.
Post Reply