golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.35k stars 17.71k forks source link

image: support LJPEG #22535

Open TuomLarsen opened 7 years ago

TuomLarsen commented 7 years ago

Please consider adding support for Lossless JPEG (SOF3, aka LJPEG). This format is used in medical imaging (DICOM) and RAW files of digital cameras (DNG). An argument for this to be in standard library is that most of the required parts are already in place (JPEG parser, Huffman coding), whereas an external library would need to replicate those private methods.

dsnet commented 7 years ago

Is this a proposal to add support for it to the standard library? If so I doubt this meets the high bar set for inclusion in the standard library.

On the other hand, if this is a proposal for inclusion into the "golang.org/x/image" repo, that is far more plausible.

ianlancetaylor commented 7 years ago

CC @nigeltao

nigeltao commented 7 years ago

As a feature request, I suppose it's a valid feature request.

Whether or not it lives in image or x/image depends on how much code it would share or not share with the existing image/jpeg package. You mention the JPEG parser (which is trivial) and the Huffman coding (less trivial), but on a quick skim, the https://en.wikipedia.org/wiki/Lossless_JPEG page says that "Lossless JPEG... [uses] a completely different technique from the lossy JPEG standard".

Either way, though, I really don't have any spare time to work on this myself. If you want to try doing this yourself, I would suggest starting by forking the standard library's image/jpeg code. It'd be easier to make the image vs x/image decision after we have at least a rough proof of concept implementation to look at.

anfernee commented 7 years ago

It will be an interesting side project!

bradfitz commented 7 years ago

I've un-proposaled this. If somebody wants to write code, then we can consider where it lives.

as commented 6 years ago

If nobody is working on this I'll absorb the task.

bernardopericacho commented 3 years ago

Is there any plan or progress to support Lossless JPEG either image or x/image?

nigeltao commented 3 years ago

No plans. I still don't have any spare time and I don't know of anyone else working on it.

jamesshenjian commented 1 year ago

Try this : https://github.com/jamesshenjian/jpegsl , a simple decoder implemented in go. Any problem please let me know.