jpeg-js / jpeg-js

A pure javascript JPEG encoder and decoder for node.js
Other
565 stars 125 forks source link

Support for encoding progressive jpegs #12

Open avalanche1 opened 9 years ago

avalanche1 commented 9 years ago

Is it hard to implement? My proj does image manipulation client-side and it would be nice to be able to encode progressive jpegs.

tomByrer commented 8 years ago

I've done some research for another project. Tricky, but surprised no one transposed existing C code over.

tomByrer commented 7 years ago

Here is a PJEG splitter: https://gist.github.com/Hodapp87/9220146

avalanche1 commented 7 years ago

Interesting. Will ask someone with C exp to replicate that in JS; when I have that someone)

tomByrer commented 7 years ago

https://github.com/kripken/emscripten ?

benwiley4000 commented 7 years ago

I'm no progressive jpeg expert (@patrickhulce have you looked into this?) however from the look of that code @tomByrer it looks like it's more related to decoding a progressive jpeg into separate slices? whereas if I understand your question correctly @avalanche1 you want to take an arbitrary image data array and encode it as a progressive jpeg?

I'm not really sure how complex this would be, but we'd welcome ideas or even a pull request!

patrickhulce commented 7 years ago

Encoding is slightly more hairy then decoding IMO, I haven't spent any time digging in to it. It might be worth establishing some goals of the project or at least guidelines for deciding if an aspect of JPEG should be worth maintaining here? Progressive encoding probably makes the cut, but the realm of possibilities is quite large and we have limited time :)

benwiley4000 commented 7 years ago

It doesn't help that there don't seem to be any real progressive encoding solutions out there already in pure-javascript land! 😢

tomByrer commented 7 years ago

Encoding is slightly more hairy then decoding IMO

Probably correct if you don't hardcode the scans. Thanks for getting the decoding in @eugeneware!

Might be better as an 'plugin' or external include, since the code is unlikely to be used by all & likely to be sizable.

research notes: http://cloudinary.com/blog/progressive_jpegs_and_green_martians