Simple brightness adjustment

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

A faster function is to use -evaluate add 0.2
It is a set of apply constant to all images function that was added before the more generate -fx operator was created.

As for -fx speed, cristy has plans to 'compile' the -fx argument before applying it to each pixel/value, in the current image. this should imcrease its speed by several orders of magnitude for large images. When, is of course the question.

ASIDE: -fx currently does not use -region to limit its operations to a specific area.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Not really, just a place holding in the IM Examples transformaton area, after the FX stuff.
http://www.cit.gu.edu.au/~anthony/graph ... /#evaluate
Basically like -fx values are cliped to a 0.0 to 1.0 range, but only a single contant operation can be applied.

However I do use it in a couple of places, such as in darkening the output from -shadow for generating fuzzy outlines...
http://www.cit.gu.edu.au/~anthony/graph ... ow_outline

Or in the generation of Gel Effects...
http://www.cit.gu.edu.au/~anthony/graph ... el_effects
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

If I read the code correctly, the argument to the evaluate "add" operator should a be real decimal number with an optional percent sign after it.

Code: Select all

-evaluate add 10
will add 10 to each pixel whereas

Code: Select all

-evaluate add 10%
will add ten percent of the quantume range to each pixel. Once a pixel reaches its maximum value (QuantumRange) it will not be changed any further.
The code uses the strtod C function to convert the input value, so it ought to be returning a zero if you specify a hex value such as 0x0780. I tested it with "0x20" and "0x2080" and neither of them changed the image.


Pete
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

If what you say about percentages are true then the current code is wrong.
As I have not as yet explored the function, I couldn't say for certian.

However my understanding is that it works in the same way as -fx, whch normalizes all values to a 0.0..1.0 range, before and after the calculations. This is what it seems to do.

Anyone else with a view about this?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply