Convert image to binary and get hex code for it

I need to convert image (.jpg or anything else) to binary image (only black and white pixels) and than to get hex code of that binary image (like the file in att).

How to do that? :slight_smile:
I have this bitmap (att) in hex code and I see it in BW,but it have much more possibles values than two…how that’s possible,what kind of coding is that?

code.txt (7.22 KB)

Converting a JPEG to a bitmap on an AVR is tricky, verging on the impossible. Thresholding a bitmap, on the other hand, is trivial - either use a lookup table or a simple "if".

No,no,it's not necessary to converting that with AVR,I just need hex code of some jpg image to display that image later, only with black and white pixels. How to get that code...and I need a little explanation of the file attached.

So this attached is what I need, with any software and of course with PC.

No,no,it's not necessary to converting that with AVR,I just need hex code of some jpg image to display that image later, only with black and white pixels.

A JPEG doesn't have "pixels" - its a compressed form of the image in the frequency domain, so to get thresholded pixels, you have to decompress it first, before thresholding it.

How are you displaying the attached data? What width/height is it (in pixels)? It would take a fair amount of trial and error to figure out the format of the file without at least knowing the width and height of the image.

You haven't really explained what it is you want to display, and where/how you want to display it.

In general, if you want to convert a jpg to a B/W bitmap, you would use a paint or photo manipulation program to first change the colour depth, and then to convert it to a bitmap. You would require another program to dump the resulting bitmap to a hexadecimal format like your attachment.

I must send only black and white pixels to my display cause i don’t have enough memory on Arduino for color image. Resolution of this (from att) is 120x96 pixels and that is the bigest resolution I can use.

I want to have image in this hex format which I will later put in one cpp file which will be used from function for displaying that image on screen with 120x96 resolution…I hope that I am now better explained :slight_smile: