Posts
22
Comments
75
Trackbacks
0
Wednesday, May 16, 2018
Simple Image Manipulation - Brightness
Last time I played with played with Pixels - Color Effect with HTML5 and JS

For this short post, let's go back to basics. Let us try to adjust an image's brightness by trying to add a value between -255 (darkest ) to 255 (lightest) to an image pixel data.

SOURCE CODE - https://jsfiddle.net/HumpreyCogay/upbnvnsb/

NOTE - an image can be loaded to an ImageData, The data attribute of this object contains a Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 (included).

below is a short sample on how to read the RGB data parts.
  RED = imageData[c ] 
GREEN = imageData[c+1] 
BLUE = imageData[c+2] 




Posted On Wednesday, May 16, 2018 6:34 PM | Comments (2)
Tag Cloud