FAQ
I'm having some problems with gif images.

I'm running from head with the patch applied from issue
6441<https://code.google.com/p/go/issues/detail?id=6441>,
which should fix a problem with the local color table.

The goal is to resize an animated gif. Since frames are cumulatively
stacked this can lead to aliasing problems. So to get round this I build
up frames from the previous frames before resizing. They are resized as
RGBA and then converted back to a paletted image.

This works fine for many different gifs, but the example image in
6441<https://code.google.com/p/go/issues/detail?id=6441>still has
problems. See:
    https://raw.github.com/dpup/go-scratch/master/gif-resize/shapes.out.gif

Frame 19 is one of the problem frames, but here is the frame saved as a
jpeg:

https://github.com/dpup/go-scratch/blob/master/gif-resize/frames/shapes.19.jpg

Here's a reduced test case that demonstrates the issue:
    https://github.com/dpup/go-scratch/blob/master/gif-resize/gif-resize.go

Does anyone have any clues as to what might be going on here?

-- Dan

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Dan Pupius at Oct 21, 2013 at 11:33 pm
    On a whim I wired up a version of the MedianCut quantizer from
    andybons/gogif <https://github.com/andybons/gogif/blob/master/mediancut.go>.
      That fixes these artifacts.

    -- Dan

    On Mon, Oct 21, 2013 at 2:07 PM, Dan Pupius wrote:

    I'm having some problems with gif images.

    I'm running from head with the patch applied from issue 6441<https://code.google.com/p/go/issues/detail?id=6441>,
    which should fix a problem with the local color table.

    The goal is to resize an animated gif. Since frames are cumulatively
    stacked this can lead to aliasing problems. So to get round this I build
    up frames from the previous frames before resizing. They are resized as
    RGBA and then converted back to a paletted image.

    This works fine for many different gifs, but the example image in 6441<https://code.google.com/p/go/issues/detail?id=6441>still has problems. See:
    https://raw.github.com/dpup/go-scratch/master/gif-resize/shapes.out.gif

    Frame 19 is one of the problem frames, but here is the frame saved as a
    jpeg:

    https://github.com/dpup/go-scratch/blob/master/gif-resize/frames/shapes.19.jpg

    Here's a reduced test case that demonstrates the issue:
    https://github.com/dpup/go-scratch/blob/master/gif-resize/gif-resize.go

    Does anyone have any clues as to what might be going on here?

    -- Dan
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Nigel Tao at Oct 22, 2013 at 1:49 am

    On Tue, Oct 22, 2013 at 8:07 AM, Dan Pupius wrote:
    Here's a reduced test case that demonstrates the issue:
    https://github.com/dpup/go-scratch/blob/master/gif-resize/gif-resize.go
    Some of those frames have transparent pixels. You may want to use
    draw.Over instead of draw.Src.

    The two are equivalent of the source is fully opaque, but in this case
    they are not.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dan Pupius at Oct 22, 2013 at 1:54 am
    Oh man, that was it. Thanks!

    -- Dan

    On Mon, Oct 21, 2013 at 6:49 PM, Nigel Tao wrote:
    On Tue, Oct 22, 2013 at 8:07 AM, Dan Pupius wrote:
    Here's a reduced test case that demonstrates the issue:
    https://github.com/dpup/go-scratch/blob/master/gif-resize/gif-resize.go

    Some of those frames have transparent pixels. You may want to use
    draw.Over instead of draw.Src.

    The two are equivalent of the source is fully opaque, but in this case
    they are not.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 21, '13 at 9:07p
activeOct 22, '13 at 1:54a
posts4
users2
websitegolang.org

2 users in discussion

Dan Pupius: 3 posts Nigel Tao: 1 post

People

Translate

site design / logo © 2021 Grokbase