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

Background colors #25

Closed
reinink opened this issue Jan 14, 2015 · 3 comments
Closed

Background colors #25

reinink opened this issue Jan 14, 2015 · 3 comments

Comments

@reinink
Copy link
Contributor

reinink commented Jan 14, 2015

Right now if you convert a transparent PNG file to a jpeg, the background becomes black. A more sane default here would probably be white. However, it probably makes even more sense to just add a background color option. I'm thinking the function could be called bg. Something like:

logo.png?bg=ffffff
@reinink
Copy link
Contributor Author

reinink commented Jan 14, 2015

It doesn't look like there is any background color option with Intervention. It appears the best way to do this is by creating a new canvas with a background color set, and then dropping the image on it. Something like:

Image::canvas(100,100, '#b53717')->insert($image);

However, there is an issue here. The current manipulators all manipulate a single Intervention\Image\Image instance. This is done by variable reference—they don't actually return the manipulated image. Creating a new image, as seen in the example above, will not work, since the new image will have to be returned, not the original. I propose updating the manipulators so that they always return an instance of Intervention\Image\Image, which is then passed to the next manipulator.

@reinink
Copy link
Contributor Author

reinink commented Jan 14, 2015

All manipulators now return an instance of Intervention\Image\Image. See 7552f3f.

@reinink
Copy link
Contributor Author

reinink commented Aug 10, 2015

Closing this ticket. I've added the bg functionality, and it has been merged into the master branch and will be tagged shortly when I release v1.0! Hopefully not long now.

Also, see the docs for this feature here.

@reinink reinink closed this as completed Aug 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant