Background colors #25

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

Comments

Projects
None yet
1 participant
@reinink
Member

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

This comment has been minimized.

Show comment
Hide comment
@reinink

reinink Jan 14, 2015

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@reinink

reinink Jan 14, 2015

Member

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

Member

reinink commented Jan 14, 2015

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

@reinink reinink added the enhancement label Mar 2, 2015

@reinink

This comment has been minimized.

Show comment
Hide comment
@reinink

reinink Aug 10, 2015

Member

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.

Member

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 Aug 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment