Check out Unraveling the JPEG from Omar Shehata on Parametric Press[1] for an interactive essay on the JPEG format.<p>Very cool to be able to manipulate the bytes directly and seeing how it affects the image.<p>[1] <a href="https://parametric.press/issue-01/unraveling-the-jpeg/" rel="nofollow">https://parametric.press/issue-01/unraveling-the-jpeg/</a>
Hexfiend (open source hex editor for mac) [0] and synalize it [1] (closed source hex editor for mac) both support a similar feature (hexfiend only in the newest github release) that shows the structure of known file formats similar to what wireshark [2] does for network packages.<p>Thought about writing an hex editor or adding the hex fiend functionality to other hex editors based on the templates of hex fiend.<p>[0] <a href="http://ridiculousfish.com/hexfiend/" rel="nofollow">http://ridiculousfish.com/hexfiend/</a><p>[1] <a href="https://www.synalysis.net/" rel="nofollow">https://www.synalysis.net/</a><p>[2] <a href="https://www.wireshark.org/" rel="nofollow">https://www.wireshark.org/</a>
This repo from the author is full of gold. Shows the details and visualization of various file structures (including multiple zip formats, image formats and executable files)<p><a href="https://github.com/corkami/pics" rel="nofollow">https://github.com/corkami/pics</a>
By the way, you can decode JPEG with less artifacts using these projects:<p><a href="https://github.com/ilyakurdyukov/jpeg-quantsmooth" rel="nofollow">https://github.com/ilyakurdyukov/jpeg-quantsmooth</a> (good for most mid-quality and high-quality images)<p><a href="https://github.com/victorvde/jpeg2png" rel="nofollow">https://github.com/victorvde/jpeg2png</a> (use for very low-quality images, slower)<p>jpeg-quantsmooth gives a sharper output (use "-q6" option).<p>jpeg2png output is a little blurry, but it does a better job of unblocking very low-quality images.
If you're looking for a fun project that can be completed in a weekend or less, one of the things I recommend is to write a (baseline) JPEG decoder. The official spec (linked from the article near the top) is quite readable as far as standards go, and even contains helpful flowcharts for basically the whole process. When I did it, it took less than 1kLoC of C, including some minor optimisations like array-based Huffman decoding (although the version in the spec is quite compact, it is slower --- but still not as slow as the "theoretical" bit-by-bit tree-traversal that a lot of other tutorials on Huffman show.)<p>H.261 (a video format) is roughly of the same if not slightly less complexity, and also makes a good weekend project.
I wish I had had this when I wrote my 250 LOC jpeg visualizer!<p><a href="https://github.com/aguaviva/micro-jpeg-visualizer" rel="nofollow">https://github.com/aguaviva/micro-jpeg-visualizer</a>
This is great, I was literally banging my head against a wall last night trying to determine how the length of the ECS was determined. What a lucky coincidence!<p>I'm trying to build a small C# library to support reading image types to learn about them, png was quite understandable but jpg is a little trickier, given I panic when I see maths.
Very nice read, thanks for posting it!!!<p>I also learned a lot from the various JPEG articles on ImpulseAdventure (no affiliation), e.g.:<p><a href="https://www.impulseadventure.com/photo/jpeg-quantization.html" rel="nofollow">https://www.impulseadventure.com/photo/jpeg-quantization.htm...</a><p><a href="https://www.impulseadventure.com/photo/jpeg-compression.html" rel="nofollow">https://www.impulseadventure.com/photo/jpeg-compression.html</a><p><a href="https://www.impulseadventure.com/photo/chroma-subsampling.html" rel="nofollow">https://www.impulseadventure.com/photo/chroma-subsampling.ht...</a><p>They also have a lot of practical stuff (which chroma subsampling will Photoshop actually use when you save at 80% quality?) in addition to the theory.
This is great!<p>The model used by JPEG is not that unusual in image processing, so this can help us to understand many types of processes.<p>This person has a whole bunch of this stuff! Gold!<p><a href="https://github.com/corkami" rel="nofollow">https://github.com/corkami</a>
They could also note how 3D MPO images work, they’re just two jpegs concatenated together with some special markers. It’s been a while but I’ve written MPO parsers for a couple languages.
I have a question in case someone knows:<p>If I wanted to develop a custom JPEG decoder, what would be the easiest way to get image data from a jpeg file into Tensorflow (or numpy, Pytorch, etc.) tensors? I mean the raw DCT coefficients, and the coefficient table?
> lossless storage:<p>> to make JPEG store data losslessly: use grayscale, 100% quality, then either width or eight to 1 pixel, or duplicate the padded data 8 times (JPEG images are stored in 8x8 blocks).<p>Interesting. I wonder if this is used internally in any applications.