Support for lossless encoding/decoding in image/jpeg?

Hi all, I’m writing a simple raw image editor in go. Specifically using the CR2 format. The raw image data is encoded in lossless (sequential) jpeg denoted by the SOF3 header. The definitions are in defined in the same document that image/jpeg GoDoc references: http://www.w3.org/Graphics/JPEG/itu-t81.pdf. I was just curious if anyone is familiar with the image/jpeg source code and if I would easily be able to add support for this format in that library. Is it worthwhile to try and add to that library or should I write my own? How likely is it that if I add the necessary code that it would get picked up in a future version of Go? Thanks for any help!

Regarding your second question, my guess is that it is rather unlikely to get this into the standard library.

First, AFAIK the stdlib is maintained by the core Go team and they are surely very cautious about extending the stdlb with more and more and more functionality.

Second, CR2 is one of many image formats. (It is also a proprietary format by Canon.) When adding support for CR2, requests for supporting more image formats will follow. And there are really many of them - just have a look at the file types that ExifTool supports.

I’d say just write your own CR2 package and publish it on GitHub or elsewhere, and add it to godoc.org. Anyone who searches for CR2 libraries surely will find it. Whether or not it is part of the stdlib is maybe not as important.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.