Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding background color to transparent png and output format jpg #44

Open
labr1005 opened this issue Aug 30, 2016 · 2 comments
Open

Adding background color to transparent png and output format jpg #44

labr1005 opened this issue Aug 30, 2016 · 2 comments
Labels

Comments

@labr1005
Copy link

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.

@labr1005
Copy link
Author

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`]]

@labr1005
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants