Improvements to image/gif

239 views
Skip to first unread message

moshen...@gmail.com

unread,
Feb 10, 2015, 7:51:33 PM2/10/15
to golan...@googlegroups.com
I realize that https://golang.org/doc/contribute.html states that I should discuss before coding, but while smacking away at my keyboard to make a little toy go project (https://github.com/moshen/gotermimg) work, I made some "improvements" to image/gif:

https://github.com/moshen/go/compare/golang:master...master

While most of the changes are minor, extracting and exposing frame disposal to know how to handle frame data in the context of an animation, I did add an "Explode" method to GIF.  This basically returns a slice of complete (full gif bounds) image.RGBA, each derived from a frame and it's accompanying data.  Definitely something that's needed to do lots of neat things with gifs, but is it a welcome contribution to the stdlib?  Suggestions?

I apologize for breaking the rules on my first post to the list.

Thanks,
Colin

Nigel Tao

unread,
Feb 10, 2015, 9:33:52 PM2/10/15
to moshen...@gmail.com, golang-nuts
On Wed, Feb 11, 2015 at 11:51 AM, <moshen...@gmail.com> wrote:
> While most of the changes are minor, extracting and exposing frame disposal
> to know how to handle frame data in the context of an animation, I did add
> an "Explode" method to GIF.

I'm OK with adding the fields to the GIF struct, since that's part of
the file format, but I'm hesitant to add a GIF.Explode method to the
standard library. Once GIF gains the Disposal and other fields, it
seems like Explode can exist in your own code for now, that *uses*
package gif, instead of being *in* package gif. Even if it eventually
belongs in the stdlib, I'd like some bigger-picture thinking done
first about Go APIs for video and animation in general, not just for
GIFs, and I'd rather not commit to any particular
we-won't-break-back-compat API in the stdlib until we've done that
thinking (and some proof of concept implementations for some common
video formats).

BTW your fillIn function could be a single draw.Draw call. See
"Filling a Rectangle" in http://blog.golang.org/go-imagedraw-package

Rob Pike

unread,
Feb 10, 2015, 10:46:37 PM2/10/15
to Nigel Tao, moshen...@gmail.com, golang-nuts
Nigel is right.

-rob



--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

colin

unread,
Feb 11, 2015, 2:05:25 PM2/11/15
to Rob Pike, Nigel Tao, golang-nuts
Gotcha.  Will remove Explode before submission.

BTW your fillIn function could be a single draw.Draw call. See
"Filling a Rectangle" in http://blog.golang.org/go-imagedraw-package

Whoops!  Thanks.

Colin

Nigel Tao

unread,
Apr 9, 2015, 3:03:44 AM4/9/15
to colin, Rob Pike, golang-nuts
Ah, I didn't realize that you'd mailed out
https://go-review.googlesource.com/#/c/4620/

I'll take that code review.
Reply all
Reply to author
Forward
0 new messages