mozilla/pdf.js — pull request #4246 by bsl-zcs (2014-02-04 19:37:50+00:00)
Title: Support for the image mask in higher resolution than the image itself

Advanced PDF compressors (such as FineReader) decompose scanned page into three images: colored background in medium resolution, 1bpp text mask in very high resolution and image filled with text colors in very low resolution. Cutting mask pixels from text-colored image produces layer with colored text in high resolution, while storing its components separately with different resolutions, compression levels and algorithms greatly reduces compressed file size.

Currently in pdf.js resulting masked image with colored text is badly pixelated, because the mask is scaled down to its color component size.

Proposed patch calculates masked image size from its largest component dimensions.