How to get bits from jpg image

Context :

I coded an image generator. You choose a String as input, every char is converted into its binary ascii value and each bit represents a pixel (0 = white, 1 = black). The result is save as “image.jpg”

Question :

Now I’m coding the image decoder(in order to get a string from the image), but I have no idea of how I could get the array of bits back.
The first thing I did was to create an array of int and assign to it the value of image.pixels
But I can’t make sense of the result.

Any idea what to do?

1 Like

I just realised that jpg is not a lossless format, therefore what I want to achieve may be impossible

The idea is valid.

Just use pixels to receive your ascii binaries and then vice versa.

Or use bmp

Thank you, it worked perfectly

Hello @0ldBergamot,

There are other lossless formats available to you.

Take a look at the advanced section here:
https://processing.github.io/processing-javadocs/core/processing/core/PImage.html

Try this:

printArray(javax.imageio.ImageIO.getReaderFormatNames());

println() also prints a line of formats but gives an error message.

:)