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

image: NewPaletted generated picture is not clear #17685

Closed
zouhuigang opened this issue Oct 31, 2016 · 2 comments
Closed

image: NewPaletted generated picture is not clear #17685

zouhuigang opened this issue Oct 31, 2016 · 2 comments

Comments

@zouhuigang
Copy link

@zouhuigang zouhuigang commented Oct 31, 2016

f8, err := os.Open("734.jpg")
if err != nil {
	fmt.Println(err)
}
defer f8.Close()

g8, err := jpeg.Decode(f8)
if err != nil {
	fmt.Println(err)
}

//p8 := image.NewPaletted(image.Rect(0, 0, 150, 150), palette.Plan9)
p8 := image.NewRGBA(image.Rect(0, 0, 150, 150))
draw.Draw(p8, p8.Bounds(), g8, image.ZP, draw.Over) //添加图片
imgcounter3 := 738
saveImage(fmt.Sprintf("%03d.jpg", imgcounter3), p8)
@zouhuigang
Copy link
Author

@zouhuigang zouhuigang commented Oct 31, 2016

Generate an animated GIF from static images:
before

after

Loading

@rakyll rakyll changed the title NewPaletted generated picture is not clear image: NewPaletted generated picture is not clear Oct 31, 2016
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Oct 31, 2016

For help with Go, see https://golang.org/wiki/Questions

Maybe your question is about dithering. See https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering which is also built in to the standard library: https://golang.org/pkg/image/draw/#Drawer

Loading

@bradfitz bradfitz closed this Oct 31, 2016
@golang golang locked and limited conversation to collaborators Oct 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants