jai-imageio / jai-imageio-core

JAI ImageIO Core (without javax.media.jai dependencies)
Other
234 stars 87 forks source link

Fast Thumbnails #66

Open wordlessly opened 5 years ago

wordlessly commented 5 years ago

To get a thumbnail you need to decode the full picture and then scale it to thumbnail size. To overcome this obstacle the jpeg-format allows you to get a picture 1/2, 1/4, 1/8 or even 1/16 in size of the original picture. E.g. for a factor 1/8, a 5000x5000 picture will be returned as a 625x625 picture. Java does NOT offer this functionality (C++ libs like ijg do).

For jpeg thumbnails you just need the DC components and skip all the AC components. This means you only have to decrypt the DC component. You still have to do the full Huffman decompression, but still it saves a hell lot of time, disk I/O, memory and exceptions.

Pure (but clever) Java, especially multi-threaded Java often beats native performance-wise. This lack of fast thumbnail support shaped the type of apps you could write with Java over the last 20 years. Fast thumbnails are ESSENTIAL!

Please implement!