Insert PNG with alpha channel using FPDF (PHP)

Raptor picture Raptor · Jun 17, 2010 · Viewed 29.9k times · Source

In official documentation of FPDF, it said alpha channel is not supported for PNG.

Is there any workaround?

Answer

qualbeen picture qualbeen · Mar 14, 2011

If you need to put a transparent image on top of another: use PHPs build in functions to copy one image onto the other one. Then you will end up with a new picture, containing boths images. Save as a non-alpha png, and insert.

There's an example here of the code needed to combine the images.

If you want text to be visible under you picture: insert the picture first, then write you text into the document.