Image as a string of binary numbers
1 view (last 30 days)
Show older comments
Is there a way to convert a .jpg or .gif into a string of binary numbers?
I want to have a string of binary numbers that could be copied from a word document then read back in MATLab as a picture.
I would also need to know what function could such a string as an image.
0 Comments
Answers (1)
Walter Roberson
on 3 Mar 2014
Converting to text:
dec2bin(TheImage,8)
Converting back:
reshape(uint8(bin2dec(TheStringArray)), size(TheImage))
4 Comments
Walter Roberson
on 5 Mar 2014
Hunter: use reshape() to change it into a vector. Just be sure to reshape() back the right way!
See Also
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!