You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am, unable to produce proper gifs, there are always artifacts or loss of visual quality, even if gif is encoded without errors. I saw examples here and am processing individual frames but the result is always garbage. Changing filters did not help either. Any idea why?
g, err:=gif.DecodeAll(src)
iferr!=nil {
returnerr
}
g.Config.Height=0g.Config.Width=0fork:=rangeg.Image {
src:=image.Image(g.Image[k])
forj:=rangerules {
src=rules[j].Apply(src, filter)
}
tmp:=image.NewPaletted(src.Bounds(), g.Image[k].Palette)
draw.Draw(tmp, src.Bounds(), src, image.Point{}, draw.Src)
g.Image[k] =tmp// find the largest image in the set(should be the first one)iftmp.Bounds().Max.X>g.Config.Width||tmp.Bounds().Max.Y>g.Config.Height {
g.Config.Width=tmp.Bounds().Max.Xg.Config.Height=tmp.Bounds().Max.Y
}
}
returngif.EncodeAll(dst, g)
But it is inconsistent. The following are three random gifs from the internet. The first one is most problematic. It's like there are two gifs within one(it's weird and I cannot make it work properly with this one), second one is losing color information and produces artifacts. Third one is totally fine.
I am, unable to produce proper gifs, there are always artifacts or loss of visual quality, even if gif is encoded without errors. I saw examples here and am processing individual frames but the result is always garbage. Changing filters did not help either. Any idea why?
I have just one resize rule for testing(called by the Apply).
The source is random gif from the internet with 800x600 dimensions and I am testing resizing to half.
Source:
Result(also 3x in file size)
The text was updated successfully, but these errors were encountered: