png由于fireworks生成的数再进一步处理,还原出来的数据还要计算下
这两天查遍了互联网,和无数次生成数据手工计算还原,希望找到个规律
从一篇提示想到手工猜测,我用php写了一个模板,枚举了很多种算法。直接显示结果
如果能还原出来跟fireworks看到的值一样说明民成功的。
这里有一个仁兄提问,他说是位运算
我后来发现是加减运算
http://tieba.baidu.com/f?kz=859640399

01 就是后面一个RGBA加上前边一个RGBA
02 就是下面原始数据加上上面解码出来的RGBA
04 在下面有说明
03 是前边一个字节加上上边对应一个字节然后除2 然后加上本字节 比如(前R+上R)/2+R(本字节R)
这个适合真彩情况,window画图生成的png并没有编码,直接放RRGGBBAA
我推理了一天才发现03这种情况 所以如果png IDAT 遇到真彩解码或编码问题可以多试下
行头为04数据格式
| 00 | C | B |
| 04 | A | X |
| Type byte | Filter name | Predicted value |
|---|---|---|
| 0 | None | Zero (so that the raw byte value passes through unaltered) |
| 1 | Sub | Byte A (to the left) |
| 2 | Up | Byte B (above) |
| 3 | Average | Mean of bytes A and B, rounded down |
| 4 | Paeth | A, B, or C, whichever is closest to p = A + B − C |
Table 1. Predictor states used for differential encoding in the PNG image format.
The Paeth filter computes a simple linear function of the three neighboring pixels (a, b, c), then
chooses as predictor the neighboring pixel closest to the computed value as defined by the
following pseudo-code:
// Input: color values a,b, and c as illustrated in Figure 3
// a = left, b = above, c = upper left
// Output: a paeth-prediction for a,b, and c
04方式求出X的伪代码
paeth_predict(a,b,c)
p := a+b-c
pa := abs(p-a)
pb := abs(p-b)
pc := abs(p-c)
IF (pa<=pb AND pa<=pc) p := a
ELSE IF (pb <= pc) p := b
ELSE p := c
paeth_predict := p
Compression of a pixel value x dependent on its neighbors a,b, and c works by calculating
compressed(x) = x - paeth_predict(a,b,c)
and decompression works by reversing the formula to
uncompressed(x) = compressed(x) + paeth_predict(a,b,c).
http://en.wikipedia.org/wiki/Portable_Network_Graphics
http://ngs.ics.uci.edu/teaching/winter2011/Multimedia/textbook/MM_Chapter_lossycomp_100220.pdf
具体看下面这里
http://www.w3.org/TR/PNG/#9Filters
本文探讨了PNG IDAT数据块的解码问题,特别是针对Fireworks生成的PNG文件。通过分析和实验,作者发现解码涉及到加减运算,尤其是03滤波器的处理方式,即前一个字节加上上一个字节除以2再加上当前字节。还提到了04滤波器的Paeth预测算法,并提供了相关伪代码。文章引用了W3C和学术资料,为解决PNG真彩编码和解码问题提供了解决思路。
4666

被折叠的 条评论
为什么被折叠?



