how can i convert an image to bit stream

hey all is ther any way to convert image to bit stream or to ASCII code ?? please i need ur help thanks in advance

3 Comments

If the image is converted to uint8() format (simply by taking uint8(Image)), it is already in ASCII format-- you can then reshape() the resulting matrix into a single row/column to get a byte stream. Something like this:
Image8 = reshape(uint8(YourImageMatrix), 1, []);
Note that if you have an indexed image, this will saturate your image at 255 unless you have converted it to RGB before, using ind2rgb().
Technically not: ASCII is only from 0 to 127, not 0 to 128. Also note that not all ASCII characters are printable, and that some ASCII characters (such as NUL or IDLE) may be "eaten" by communications systems.
To transform a data array to printable ASCII, using "uuencode" or the like is recommended.
@matt kinding thank you very much i have got that

Sign in to comment.

 Accepted Answer

dec2bin(typecast( YourImageMatrix(:), 'uint8' ), 8)
Now what?

2 Comments

thaaaank you very much i got the correct result
Hi there is it possible, if I change the image into a stream and then add another stream to that one, OR NOT please need help as fast as you can thanks

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!