FPDF requires ZLib if images are not flattened

We discovered today that when Photoshop saves an apparently flattened image, sometimes you still have to select Layer > Flatten. In other words “1 layer” is not equal to “flattened”.

The issue was a PHP application that uses the remarkable FPDF libary (fpdf.org) to create PDF signs. The platform we’re running on (Heroku) does not support the ZLib compression library, so we were careful not to explicitly require compression.

Nonethless, signs using certain images were throwing an error that ZLib was not installed so FPDF could not access the alpha channel.

The culprit turned out to be images created with Photoshop that were a single layer, but it was an unlocked and named background layer. That, apparently, is not a completely flattened image (even though it is a single layer).

The fix was simple: select Layer > Flatten and re-save the image.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.