How to extract each pixel of an camera image in text format (in low language)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to extract each pixel of an camera image in text format (in low language)?

I want to extract each pixel of an image from a image format such .PNG or any format and to keep it in text format as .txt. I mean I want to know what colour has each pixel in terms of colour code (it may be in binary format).

28th Sep 2017, 8:31 PM
Raman Kumar
4 Answers
+ 18
(default is PNG)
30th Sep 2017, 5:30 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 15
On js you can draw image on canvas and export with canv.toDataURL. This will return the image in base64 format which can be stored as string.
28th Sep 2017, 8:36 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
+ ValentinHacker's answer, the default output format is (I believe) JPG -- PNG-encoded base64 should be smaller.
28th Sep 2017, 9:40 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Why indeed it is; I could have just tested since I have an export. data:image/png;base64,[...data....] Thanks!
30th Sep 2017, 5:34 PM
Kirk Schafer
Kirk Schafer - avatar