Skip to content

How add custom dither filter with paletted image #25

@diantanjung

Description

@diantanjung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions