Fruits of YAPC::Europe - Image::JpegMinimal
With the help of Imager, it turns this image
into a tiny, tiny preview image like this
and then blows that image up and blurs it in the browser,
so that the user sees the following image until the real
image data has been loaded:
Implementing this was quite straightforward thanks to Imager. I had to build a JPEG frame parser to strip out the unwanted JPEG frames from images and to reorder them so that the header can be patched in the
Maybe there could be a JPEGmin standard which declares the header as constant and only sends the dimensions and the payload data and some magic bytes to identify JPEGmin files. At least for thumbnails, this could really reduce the amount of data transferred by 50%.
Of course, declaring such a preview JPEGmin standard would ruin the complete idea of sending the image data together with the HTML, as then the latency and size of the HTTP requests for the JPEGmin files dwarfs the payload of the JPEGmin data.
I hope you enjoy the photos and maybe have some ideas on how this could be improved. The Github repo for the module is at https://github.com/Corion/image-jpegminimal, everything is licensed under the same terms as Perl.