Is it possible to edit the data in the ImageData class? #266
Unanswered
richarduuz
asked this question in
Q&A
Replies: 1 comment
-
Thank you for writing up your question. I currently can’t examine the issue myself as I don’t a computer at the moment (just a tablet) but if someone else can answer this it would be lovely. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to adjust the contrast and brightness of an image by editing the pixel data directly.
My idea was to get the corresponding ImageData by
getImageData
and then modify the data of theImageData
and then pass theImageData
intoputImageData
. But I found that although the data value of theImageData
has changed, theputImageData
method does not seem to draw the modified image.If I initialise the modified values to a new ImageData class, and pass the new one to the
putImageData
, the image can be drawn, but there is a problem with flickering when it changes continuously. My code is posted below:BTW I found that the return value structure of the
ImageData
constructor and thegetImageData
function is a bit different, despite they all return ImageData class. Please see the code and output below:and the output:
Beta Was this translation helpful? Give feedback.
All reactions