go icon indicating copy to clipboard operation
go copied to clipboard

proposal: image/gif: Allow for configure diffusion strength

Open abergmeier opened this issue 1 year ago • 1 comments

Proposal Details

The current gif error diffusion is very basic and generates low contrast images. In https://pkg.go.dev/github.com/makeworld-the-better-one/dither/v2 there is a possibility to configure Strength (affecting image contrasts) of FloydSteinberg transform (see dither.ErrorDiffusionStrength).

It would be great if at least the Strength could be added as a field to gif.Options.

abergmeier avatar Apr 26 '24 08:04 abergmeier

CC @nigeltao

ianlancetaylor avatar Apr 26 '24 22:04 ianlancetaylor

I don't see why this has to be in the standard library. Floyd-Steinberg is one of many dithering algorithms (as your https://pkg.go.dev/github.com/makeworld-the-better-one/dither/v2 shows) and part of the image/gif API design (and the existing Options.Drawer field) is that you can bring your own dithering implementations (with a Strength field or whatever else you want).

On the other hand, anything in the standard library has to be supported forever and, once released, its API is frozen forever. There's a high bar for adding anything to the stdlib at this point.

nigeltao avatar Apr 28 '24 23:04 nigeltao