Ad

Timber\Image: Is It Possible To Flatten A Transparent PNG Onto A Specific Hex Color?

- 1 answer

I would like to convert a transparent PNG to JPG and specify a background color for the transparent areas, without having to specify a dimension.

Essentially, what I'm looking for is a combination of Timber\Image's tojpg and letterbox filters, minus letterbox's width and height requirements.

Ad

Answer

@hailseitan: try grabbing the current dimensions of the image via the width() and height() methods and then feeding them into letterbox!

Ad
source: stackoverflow.com
Ad