LZW Compression Via Gif Transformation
Ältere Kommentare anzeigen
Hi everyone, i can compress an array which be formed binary data but i can't decompress it. I use "gif" transformation to compress the array.
%Generates bits with equal probabilities
n=100000;
prob = [.5 .5];
Input=[0 1];
fp =randsrc(1,n,[Input;prob]);
data1 = uint8(fp);
imwrite(data1,'1KB.gif');
fp2 = fopen('1KB.gif','rb');
data = uint8(fread(fp2));
it works but i need to de decompress it.
i need the first binary array after the decompression. How can i do that ?
Thanks for your Help.
3 Kommentare
Jan
am 26 Feb. 2018
Note that the GIF does not contain only the compressed data, but some header data also. What is "the first binary"?
fread(fp2, Inf, '*uint8') is more efficient than uint8(fread(fp2)).
samet ercetin
am 26 Feb. 2018
Bearbeitet: samet ercetin
am 26 Feb. 2018
Jan
am 26 Feb. 2018
It is not trivial to interpret the specifications of the GIF 89a standard, see https://www.w3.org/Graphics/GIF/spec-gif89a.txt. It will be much easier to use one of the functions of the file exchange. It would help to post a suggestion, if you explain, what you want to do.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Image Data finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!