We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't include grayscale png images with alpha, they appear solid.
See this file:
package main import ( "github.com/signintech/gopdf" ) func main() { pdf := gopdf.GoPdf{} pdf.Start(gopdf.Config{PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4 pdf.AddPage() pdf.Image("gradient.png", 0, 0, nil) pdf.WritePdf("image.pdf") }
and the following gradient.png:
gradient.png
The following diff solved it for me, but I don't know if this is correct or good.
diff --git a/image_obj_parse.go b/image_obj_parse.go index 4304689..90375f5 100644 --- a/image_obj_parse.go +++ b/image_obj_parse.go @@ -427,17 +427,16 @@ func parsePng(f *bytes.Reader, info *imgInfo, imgConfig image.Config) error { i++ } - info.smask, err = compress(alpha) - if err != nil { - return err - } - - info.data, err = compress(color) - if err != nil { - return err - } + } + info.smask, err = compress(alpha) + if err != nil { + return err } + info.data, err = compress(color) + if err != nil { + return err + } } else { info.data = data }
The text was updated successfully, but these errors were encountered:
Yes, I think you got it right. I have solved as you suggested and pushed up already. thank you very much
Sorry, something went wrong.
No branches or pull requests
I can't include grayscale png images with alpha, they appear solid.
See this file:
and the following
gradient.png
:The following diff solved it for me, but I don't know if this is correct or good.
The text was updated successfully, but these errors were encountered: