I read the PNG IDAT part of data (hexadecimal)
0:0:0:16:49:44:41:54:8 d: 63: fc: ff: ff: 3 f: ": c0:84:4 d: 10:24:36: while: 0:56: d4:3: d: 73-63: ca: 4 b
In addition to the length, identification code and CRC check, intermediate data section for (decimal, a total of 22 byte)
,29,99,252,255,255,63,3,54,192,132,77,16,36,54,56,37,0,86,212,3,13 {8},
How to extract data, with zlib uncompress directly get the
https://pan.baidu.com/s/1o8KvXZ8,
In the picture
The first piece is the original data
The second is the
after uncompressThe third is a compression compress2level=1
The fourth is again decompression
Why get so odd results?
CodePudding user response:
Fyi:void HexDump) (char * buf, int len, int addr) {
Int I, j, k;
Char binstr [80].
for (i=0; IIf (0==16) (I %) {
Sprintf (binstr, "% x - 08", I + addr);
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
} else if (15==16) (I %) {
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
Sprintf (binstr, "% s", binstr);
For (j=I - 15; j<=I; J++) {
Sprintf (binstr, "% s % c," binstr, ('! '& lt; Buf [j] & amp; & Buf [j] <='~')? Buf [j] : '. ');
}
Printf (" % s \ n ", binstr);
} else {
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
}
}
If (0! 16)=(I %) {
16 k=16 - (I %);
For (j=0; jSprintf (binstr, "% s", binstr);
}
Sprintf (binstr, "% s", binstr);
K=16 - k;
For (j=I - k; jSprintf (binstr, "% s % c," binstr, ('! '& lt; Buf [j] & amp; & Buf [j] <='~')? Buf [j] : '. ');
}
Printf (" % s \ n ", binstr);
}
}
CodePudding user response:
Etc have time to continue to study and see the upstairs to the teacher's code, I remember is compressed more than one wayCodePudding user response:
Why do I see have you there with data so strange, I was just reading data also encounter this problem, when I started seems to use is a decimal read a file, later changed to read binary mode, then I habitually put data & amp; 0 XFF normal just the way they areCodePudding user response: