Live data from Hacker News

Advanced Image Optimization Tricks

sixrevisions.com

11–20 of 22 posts

Re: Advanced Image Optimization Tricks

#12
post #4

Earlier quoted context omitted.

Given that these techniques seem to be well-known, it would be interesting to see a JPEG compressor which uses what we know of human vision to minimize filesize while keeping the image visually the same. JPEGmini seems to go partway with selective compression, but it seems like there's room to improve the actual compression algorithm to do things like gaussian smoothing instead of just truncating the high-frequency c…

Well the whole point of a compression scheme like JPEG is to use what we know about human vision to minimize file size while not visually changing anything. But JPEG is a pretty crude algorithm designed mainly to be computationally cheap [to match the capabilities of computer hardware in 1992 when it was created]. Trying to make better encoders within the limits of what JPEG decoders can handle is quite limiting, and…

I'm trying to write a better JPEG compressor: https://github.com/pornel/jpeg-compressor

IMHO JPEG algorithm isn't crude. IMHO it's actually quite brilliant—simple and very closely tied to human perception. The core concept of DCT quantization hasn't been beaten yet—even latest video codecs use it, just with tweaks on top like block prediction and better entropy coding.

Wavelet compressors like JPEG 2000 beat JPEG only in lowest quality range where JPEG doesn't even try to compete. Wavelets seem great, because their blurring gives them high PSNR, but lack of texture and softened edges make them lose in human judgement.

Re: Advanced Image Optimization Tricks

#13
post #4

Earlier quoted context omitted.

Given that these techniques seem to be well-known, it would be interesting to see a JPEG compressor which uses what we know of human vision to minimize filesize while keeping the image visually the same. JPEGmini seems to go partway with selective compression, but it seems like there's room to improve the actual compression algorithm to do things like gaussian smoothing instead of just truncating the high-frequency c…

Well the whole point of a compression scheme like JPEG is to use what we know about human vision to minimize file size while not visually changing anything. But JPEG is a pretty crude algorithm designed mainly to be computationally cheap [to match the capabilities of computer hardware in 1992 when it was created]. Trying to make better encoders within the limits of what JPEG decoders can handle is quite limiting, and…

> Unfortunately it’s really hard to get traction for anything else, because the whole world already has JPEG decoders built into everything.

Patents don't help either.

Re: Advanced Image Optimization Tricks

#14
post #2

"Selective JPEG Compression" was a new one for me. For PNG, always run your images through ImageOptim ( http://imageoptim.com ) before committing your work. And for large PNGs, ImageAlpha ( http://pngmini.com ) lets you reduce bit depth, keep transparency and maintain a decent image quality.

> For PNG, always run your images through ImageOptim Why only PNG?

Anecdotally, I find the best image compression using ImageOptim for PNGs and JPEGmini for JPGs. However, ImageOptim can also compress JPGs.

Re: Advanced Image Optimization Tricks

#15
post #12

Earlier quoted context omitted.

Well the whole point of a compression scheme like JPEG is to use what we know about human vision to minimize file size while not visually changing anything. But JPEG is a pretty crude algorithm designed mainly to be computationally cheap [to match the capabilities of computer hardware in 1992 when it was created]. Trying to make better encoders within the limits of what JPEG decoders can handle is quite limiting, and…

I'm trying to write a better JPEG compressor: https://github.com/pornel/jpeg-compressor IMHO JPEG algorithm isn't crude. IMHO it's actually quite brilliant—simple and very closely tied to human perception. The core concept of DCT quantization hasn't been beaten yet—even latest video codecs use it, just with tweaks on top like block prediction and better entropy coding. Wavelet compressors like JPEG 2000 beat JPEG onl…

JPEG isn't crude, agreed. But your comments seem off to me.

The core trick isn't DCT per se, it is transform coding, Which both DCY and wavelets are, followed by (usually) quantization and then entropy coding.

Typical wavelets used are orthonormal transforms, no loss there. The "lack of texture and softened edges" are a choice of the model used, not a consequence of the transform. True also of DCT and blocking artifacts. This should be obvious since both approaches allow for lossless encoders.

Typically wavelets will beat or match JPEG in any situation both in terms of psnr and the like, and perceptually (though this latter is much more controversial and poorly defined -- and to be fair I am not up to date on the literature here but I would be surprised of that has changed in the last decade).

The real reason for the huge popularity of DCT in still compression at first and video codecs later is that it is cheap to implement in hardware. And once there becomes very cheap to use.

JPEG 2000 is needlessly complex, at its core a wavelet codec is also very simple and elegant.

Re: Advanced Image Optimization Tricks

#16
OK, interesting article and some quite effective tricks but this is not "optimization". Optimization means getting the best possible result from something, by some criterion. For example, blurring an image and then getting a bit better compression is not optimal. But if it could be shown that was getting the best possible compression for JPEG then it would be optimal.

The article should be called "Image Compression Tricks". I don't think any of the techniques are considered advanced in today's technology.

Re: Advanced Image Optimization Tricks

#18
post #3

Gaussian Blur JPEG Optimization Blurring reduces noise/entropy so that JPEG compresses better. You can use a bilateral filter (Photoshop: Surface Blur; GIMP: Selective Gaussian Blur) for larger amount of smoothing while preserving edges. Image Posterization This is actually called image quantization. pngquant[1] and pngnq[2] are two specialized open-source tools for automatically selecting the best palettes to repres…

also RgbQuant :)

demo: http://o-0.me/RgbQuant/

repo: https://github.com/leeoniya/RgbQuant.js

Re: Advanced Image Optimization Tricks

#19
The example images they use are the ideal use cases for each of these techniques. The rocks photo has no hard edges. Wood texture by nature is similar to what posterization does. These tricks won't help in many cases. Although if you do happen to have something that fits the criteria, these should be quite useful.

Re: Advanced Image Optimization Tricks

#20
post #2

"Selective JPEG Compression" was a new one for me. For PNG, always run your images through ImageOptim ( http://imageoptim.com ) before committing your work. And for large PNGs, ImageAlpha ( http://pngmini.com ) lets you reduce bit depth, keep transparency and maintain a decent image quality.

> For PNG, always run your images through ImageOptim Why only PNG?

I'm not the OP, but I've had trouble with the JPEGOptim feature of ImageOptim. It created JPEG files that crashed the JPEG decoder on some older android phones.

The files worked fine elsewhere, so I think it was an decoder bug not an invalid file, but I had to avoid optimizing JPEG files to avoid the problem.

This was about two years ago, so I don't recall version numbers or phone models.

Post reply on HN