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
Before getting into the details, I have verified that this is not an upstream issue with disintegration/gift. I tested with this:
main.go
package main
import (
"image""image/png""log""os"
_ "image/png""github.com/disintegration/gift"
)
funcmain() {
// Get the background image (24 bit: indexed not true color)f, err:=os.Open("background.png")
iferr!=nil {
log.Fatal(err)
}
bgImage, _, err:=image.Decode(f)
iferr!=nil {
log.Fatal(err)
}
// Get the foreground image (24 bit with 8 bit alpha channel)f, err=os.Open("foreground.png")
iferr!=nil {
log.Fatal(err)
}
fgImage, _, err:=image.Decode(f)
iferr!=nil {
log.Fatal(err)
}
// Create a new image with dimensions of the bgImage.dstImage:=image.NewRGBA(bgImage.Bounds())
// Copy the bgImage to the dstImage.gift.New().Draw(dstImage, bgImage)
// Draw the fgImage over the dstImage at the (20, 20) position.gift.New().DrawAt(dstImage, fgImage, image.Pt(20, 20), gift.OverOperator)
// Create the composite file.f, err=os.Create("composite.png")
iferr!=nil {
log.Fatal(err)
}
deferf.Close()
// Encode the composite image.err=png.Encode(f, dstImage)
iferr!=nil {
log.Fatal(err)
}
}
Details:
Background image is a 24 bit indexed PNG file with 256 colors in its palette
Foreground image is a 24 bit true color PNG with an 8 bit alpha channel
The final (composite) image seems to be limited to the palette of the background image
Simple example:
git clone --single-branch -b hugo-github-issue-12543 https://github.com/jmooring/hugo-testing hugo-github-issue-12543
cd hugo-github-issue-12543
hugo server
Note that GIF images (also indexed) work fine.
The text was updated successfully, but these errors were encountered:
Reference: https://discourse.gohugo.io/t/image-overlay-quality-is-poor/50034
Before getting into the details, I have verified that this is not an upstream issue with disintegration/gift. I tested with this:
main.go
Details:
Simple example:
Note that GIF images (also indexed) work fine.
The text was updated successfully, but these errors were encountered: