Using Java EDIT: and a good Image Library BESIDES ImageMagick/JMagick:
I want to subtract a scalar (say 100) from the RGB values of ALL pixels, (bottoming out at zero). This is effectively darkening the image.
For example, for a given pixel with R: 20 G: 103 B: 200, after this subtraction that pixel should be R: 0 G: 3 B: 100 (again I want to quickly and efficiently perform this on ALL pixels, not just one)
I have already tried using ImageMagick and gotten imprecise results – it’s vital that the subtraction is accurate and there are no rounding errors and the such. Any other libraries that would be good at this? Are there other options that don’t deal with iterating over arrays of RGB values?
The
BufferedImageclass has both agetRGB()andsetRGB()method that can act on individual pixels or arrays of pixels.http://docs.oracle.com/javase/6/docs/api/java/awt/image/BufferedImage.html