Skip to content
New issue

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

How add custom dither filter with paletted image #25

Open
diantanjung opened this issue Jun 17, 2021 · 0 comments
Open

How add custom dither filter with paletted image #25

diantanjung opened this issue Jun 17, 2021 · 0 comments

Comments

@diantanjung
Copy link

I implemented gift.Filter interface with method Draw below. But the result plain is white image only. Is there something wrong with my code? Or How to implement gift.Filter in the right way?

func (f ditherFilter) Draw(dst draw.Image, src image.Image, options *gift.Options) {
	dst = image.NewPaletted(src.Bounds(), color.Palette{color.Black, color.White})
	draw.FloydSteinberg.Draw(dst, src.Bounds(), src, image.ZP)
}

reference: https://golang.org/pkg/image/draw/

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant