Replies: 18 comments
-
@timvandijck Any update regarding this fix? |
Beta Was this translation helpful? Give feedback.
-
Having the same problem since v11 Don't know if related, but I'm also getting this error for my transparent files:
Versions
spatie/image: 3.3.4 |
Beta Was this translation helpful? Give feedback.
-
@langeuh So using Edit/Update: |
Beta Was this translation helpful? Give feedback.
-
This should be fixed in the latest version of the spatie/image package that is used by the medialibrary package. |
Beta Was this translation helpful? Give feedback.
-
@timvandijck I checked but still I am getting the black background with the latest spatie/image package. I was initially using |
Beta Was this translation helpful? Give feedback.
-
I checked with |
Beta Was this translation helpful? Give feedback.
-
@anuzpandey5 intresting, would you mind running the test in the spatie/image package? vendor/bin/pest --filter "works with transparent pngs" I'm curious if our differences in results are machine specific or if something else is causing it. |
Beta Was this translation helpful? Give feedback.
-
@timvandijck This is still an issue. Tested on the above image with "spatie/laravel-medialibrary": "11.9.1", |
Beta Was this translation helpful? Give feedback.
-
Ok, so for anyone having this issue after migrating from older media-library - it looks like before the white backgound was the default, now you need to explicitly set in in your conversion with |
Beta Was this translation helpful? Give feedback.
-
Indeed, I believe in hindsight it was not ideal to have this default changed, but reverting it back might again cause problems for people who expect it to be there. For now passing any color that includes transparency like |
Beta Was this translation helpful? Give feedback.
-
Let's fix this when we tag a new major version :thumbnail |
Beta Was this translation helpful? Give feedback.
-
Yup still a problem. For now I have hard coded |
Beta Was this translation helpful? Give feedback.
-
Is this still planned to be fixed? The issue still seems to be there |
Beta Was this translation helpful? Give feedback.
-
@TonsiTT like said above we will likely fix this when we tag a new major. For now you can use the workaround of passing a transparent background color: $this->addMediaConversion('my-conversion')->background('#ffffff'); |
Beta Was this translation helpful? Give feedback.
-
Thanks, this issue was closed so i assumed this fell between the cracks. |
Beta Was this translation helpful? Give feedback.
-
@TonsiTT can you try passing |
Beta Was this translation helpful? Give feedback.
-
It worked well with RGBA colors, thanks for the tips! $this
->addMediaConversion('thumb')
->background('rgba(0, 0, 0, 0)')
->keepOriginalImageFormat(); |
Beta Was this translation helpful? Give feedback.
-
Nice, I might try that. Just be care of adding keepOriginalImageFormat if you already have conversions, because I did that and all existing conversions stopped working (since by default this package expects all conversions to be JPG, so it always uses a JPG, and if you specify this it will always return .png or .gif etc). So you just need to regenerate your existing conversions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As title says, when a conversion is made on transparent png image, the converted image has black background.
The new version of the package started having this issue, installed version:
11.0.4
There was an additional issue with
Fit::Crop
which has been resolved by installingspatie/images: 3.3.3
.Original Image:

Converted Image:

Beta Was this translation helpful? Give feedback.
All reactions