mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
Fix alpha/fuzzy border issue with new webp decoder for images with with transparent background
Fixes #14339
This commit is contained in:
@@ -142,7 +142,7 @@ func (d *WebpCodec) Decode(r io.Reader) (image.Image, error) {
|
||||
frames := make([]image.Image, len(destination.Bytes())/frameSize)
|
||||
for i := 0; i < len(frames); i++ {
|
||||
frameBytes := destination.Bytes()[i*frameSize : (i+1)*frameSize]
|
||||
frameImg := &image.RGBA{
|
||||
frameImg := &image.NRGBA{
|
||||
Pix: frameBytes,
|
||||
Stride: stride,
|
||||
Rect: image.Rect(0, 0, w, h),
|
||||
@@ -153,7 +153,7 @@ func (d *WebpCodec) Decode(r io.Reader) (image.Image, error) {
|
||||
return img, nil
|
||||
}
|
||||
|
||||
img := &image.RGBA{
|
||||
img := &image.NRGBA{
|
||||
Pix: destination.Bytes(),
|
||||
Stride: stride,
|
||||
Rect: image.Rect(0, 0, w, h),
|
||||
|
||||
@@ -372,7 +372,7 @@ sourcefilename: ../testdata/giphy.gif
|
||||
sourcefilename: ../testdata/sunset.jpg
|
||||
-- layouts/home.html --
|
||||
Home.
|
||||
{{ $fuzzyCircle := resources.Get "fuzzycircle.png" }}
|
||||
{{ $fuzzyCircle := resources.Get "fuzzycircle.webp" }}
|
||||
{{ $highContrast := resources.Get "highcontrast.webp" }}
|
||||
{{ $sunset := resources.Get "sunset.jpg" }}
|
||||
{{ $sunsetGrayscale := $sunset.Filter (images.Grayscale) }}
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 710 B |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
Reference in New Issue
Block a user