pThumb
pThumb copied to clipboard
Adding background color to transparent png and output format jpg
Can you confirm that it's really not possible to add a background color to a transparent png and change the output format to jpg?
On the phpthumb demo page it works... http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php#x9
[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000`]]
Result: red background, png. Close, but still a (large) png.
[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000&f=jpg`]]
Result: black background, jpg.
[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000` &useResizer=`0`]]
Result: cropped image (squared, ???), white background, png.
[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000&f=jpg` &useResizer=`0`]]
Result: cropped image (squared, ???), white background, jpg.
Doing it in 2 steps seems to work, nesting or using toPlaceholder. But this just doesn't feel right...
[[phpthumbof? &input=`[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000`]]` &options=`f=jpg`]]
[[phpthumbof? &input=`transparent.png` &options=`bg=FF0000` &toPlaceholder=`imageWithBg`]]
[[phpthumbof? &input=`[[+imageWithBg]]` &options=`f=jpg`]]
I tracked this one down to this line: https://github.com/modxcms/Resizer/blob/master/core/components/resizer/model/vendor/oo12/reductionist/src/Reductionist/Reductionist.php#L411
The check for !$outputIsJpg
prevents the creation of a jpg with a background color.
But why?