What's Changed
Bug fix: merged PDFs now preserve image quality byte-exact. Two issues caused visible color fringing/banding and inflated output size on multi-channel images:
- PNG predictor decoder ignored bytes-per-pixel. Sub/Average/Paeth filters used
current[i-1]as the "left" neighbor; for RGB-8 images (bpp=3) it must becurrent[i-bpp], so reconstructed pixels were wrong on any non-trivial filter row. - Merge re-encoded streams without
DecodeParms.copyStreamdecoded each non-image stream and re-Flate-compressed without the PNG predictor, ballooning a 9-PDF / 8 MB archive to 15 MB and routing image data through the buggy decoder above.
Reader.readStreamData now exposes the original pre-filter bytes via a new Stream.Raw field; MergeFiles / MergeBytes / MergeWithOptions write them verbatim with the source's Filter/DecodeParms chain. Dedup hashing now reads Raw (encoded size) instead of Data (decoded size) for a large CPU/memory win on big images.
- Preserve image quality on merge by @razvandimescu in #11
New API
Stream.Raw []byte— original pre-filter stream bytes when parsed from a PDF (nil for streams constructed in code). Existing consumers readingStream.Data(decoded bytes) are unaffected.
Full Changelog: v0.8.4...v0.8.5