You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an annoying case where I'm pulling images from a source using a black transparent background and haven't found any way to deal with it.
When I try to save the image without alpha after a fit() and a background() the resulting image has a black background instead of the background of my choice, on both drivers (aka not a bug).
Here is an example with a red dot over a transparent black rgba(0, 0, 0, 0) :
Using the following code:
Image::load($image)
->orientation()
->fit(Fit::Fill, 300, 300)
->background('rgba(255, 255, 255, 0)') // Try to enforce a white background when alpha channel is not supported
->save('imagick.jpg');
Will result in this:
It will be nice if we could choose how insert() handles the alpha channel or a way to define a background color when saving without alpha channel.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I encountered an annoying case where I'm pulling images from a source using a black transparent background and haven't found any way to deal with it.
When I try to save the image without alpha after a
fit()
and abackground()
the resulting image has a black background instead of the background of my choice, on both drivers (aka not a bug).Here is an example with a red dot over a transparent black
rgba(0, 0, 0, 0)
:Using the following code:
Will result in this:
It will be nice if we could choose how
insert()
handles the alpha channel or a way to define a background color when saving without alpha channel.Beta Was this translation helpful? Give feedback.
All reactions