Don't know if this is useful to anyone, but since I went to the effort of coding this for myself, I thought I'd share it in case anyone else out there found it useful.
What is it?
packJPG is an application which allows you to losslessly compress JPEGs to around 20% of their original size. I think the best formats only compress JPEG to around 25% of original size, but are significantly slower than packJPG, thus this is somewhat more 'usable'. May be useful to those who wish to reduce the size of their large photo collection (or maybe not).
Unfortunately, there's no easy way to view the .pjg files outputted by packJPG - that is, it can make browsing your collection a pain, as you'd have to decompress it all to JPEG first. The aim of this plugin is to allow you to view .pjg files directly, through my favourite image viewer, XnView.
Notes
- packJPG files are not backward compatible - that is, files created with one version can only be decompressed by the same version. This plugin only supports files packed with packJPG 2.5 (and 2.5a)
- Plugin only supports reading .pjg files - use this packJPG addon if you wish to compress JPEG to .pjg (dunno which version it uses, if it isn't 2.5, you can always use the command line tool)
- packJPG decompression is very slow! A 10 megapixel image takes around 5 seconds to show up on this 2.4GHz Q6600 (note, decompression is not multithreaded)
- To add to the above, this plugin is merely a simple .pjg -> .jpg -> raw converter. I don't know if it's possible to skip (or reduce) the JPEG encoding step - it's something I may look into later
- Because of the slow speed, it may cause XnView to hang with large images (would be nice if XnView used threading more (and multi-threaded thumbnail generation perhaps ))
- Plugin seems to work with the Windows version of XnViewMP. As the .usr file is really just a renamed .dll, I doubt it works on Linux/OSX (source code may help you compile a working plugin, once you figure out the .so equivalents of the .dll parts
Just stick xpjg.usr into XnView's plugins directory.
Source Code
Source code is included below. I can't be bothered bundling all of libjpeg-turbo, so I've included only necessary header files and a compiled .a file for compilation. It's just an unmodified libjpeg-turbo 1.2.0, so just grab from source and compile if you need it.
The stock packJPG does not appear to be thread safe, so I've had to modify it a bit to accomodate that - modified source is provided.
The actual plugin file, you may note, has a lot of crude copy-paste stuff there, so don't expect it to be tidy. I've also not done much C coding like this, so all suggestions/criticisms welcome!
For some odd reason, I can't seem to compile libjpeg-turbo in my MSYS gcc 4.6.2 environment, so this is compiled with gcc 3.4.2 (IIRC).
The rest is compiled with gcc 4.6.2, and fprofile for packJPG.
Not sure if libgcc has a conflict with MSVC - I get a MSVC runtime crash if I statically link to libgcc, so I'm guessing there may be some conflict there, but otherwise, it works for me.
Download
Since I can't find how to attach files here, you can download it from here.