go icon indicating copy to clipboard operation
go copied to clipboard

proposal: image/gif: support writing comment extensions

Open abergmeier opened this issue 1 year ago • 5 comments

Proposal Details

When reading, currently Golang ignores Comment Extensions. I have a fork of image/gif in ~~https://github.com/abergmeier/gitwriter~~ https://github.com/abergmeier/gifwriter which allows for writing Comment Extensions.

If there would be some guidance I could try to integrate that into standard library.

abergmeier avatar Apr 26 '24 11:04 abergmeier

CC @nigeltao

ianlancetaylor avatar Apr 26 '24 22:04 ianlancetaylor

Did you mean to link to https://github.com/abergmeier/gifwriter?

jfrech avatar Apr 26 '24 23:04 jfrech

Did you mean to link to https://github.com/abergmeier/gifwriter?

Indeed. Yeah sorry for that mistake.

abergmeier avatar Apr 27 '24 05:04 abergmeier

If you want to follow through with your proposal, I would advise you to a) rebase your fork so the top commit represents your diff to the standard library and b) write some documentation comments and integration tests decoding an entire image file.

jfrech avatar Apr 28 '24 15:04 jfrech

It'd be more important to reference the appropriate specs and demonstrate why this is an important addition to the standard library.

seankhliao avatar Apr 28 '24 15:04 seankhliao

The OP mentions both reading and writing GIF comments. It's not clear whether you are proposing to add reading, writing or both to image/gif.

For reading, the PNG image file format also allows for comments but image/png does not surface them, and we haven't had many (or any??) complaints about that. It's not clear that there's enough demand for being able to read GIF comments. And even if there was, go get github.com/you/yourgiflibrary is easy and idiomatic. It's not like people can't do this at all. They just can't do it with the standard library.

For writing, similarly, I don't see evidence of overwhelming demand for this feature. But also, you may be able to do this without stdlib changes: https://nigeltao.github.io/blog/2021/from-jpeg-to-jfif.html

Also, as I recently said on https://github.com/golang/go/issues/67050#issuecomment-2081704460

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 29 '24 00:04 nigeltao

@nigeltao Fair enough. For future transparency though, IMO it would be good to state the limitation/scope of the current stdlib implementation explicitly in the docs.

abergmeier avatar Apr 29 '24 05:04 abergmeier