craft-imageoptimize icon indicating copy to clipboard operation
craft-imageoptimize copied to clipboard

Don't force placeholder image format

Open ilicmarko opened this issue 5 years ago • 1 comments

Generated placeholder images have a forced jpg file format. Here is an example

image

This is a PNG image that has been converted to JPG and gets a black background. This "looks" wrong when it loads.

I find a bit of code that forces a JPG format. https://github.com/nystudio107/craft-imageoptimize/blob/2a9b385fb2ba38a601b4a04d21f62a62d8594396/src/services/Placeholder.php#L286

Maybe this can be improved to don't force the format like on the transformations or the solution to this is to generate a silhouette?

ilicmarko avatar Jun 18 '19 08:06 ilicmarko

Yeah I wish there was a way to specify what color it'd use on the background in these cases.

I'll have to think about the implications of not forcing the image to be a JPEG.

khalwat avatar Jun 18 '19 19:06 khalwat