packJPG 2.5 plugin

Plug-ins, add-ons, skins, icons, templates and other downloads. Contributions are welcome.

Moderators: XnTriq, helmut, xnview

Post Reply
Yumi
Posts: 2
Joined: Tue Mar 06, 2012 8:45 am

packJPG 2.5 plugin

Post by Yumi »

Hi there, new to the forum and not a lurker either, so hopefully I'm posting this in the correct spot.
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 :P))
  • 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
Installation
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.
morro
Posts: 6
Joined: Sun Oct 18, 2009 7:06 am

Re: packJPG 2.5 plugin

Post by morro »

Seems not working, first popout requiring libgcc_s_dw2-1.dll then libstdc++-6.dll, I downloaded and placed both files into plugin dir, but still not able to open pjg files compressed by packJPG 2.5a :|
I use with Xnview 1.99.1 on windows XP SP3.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: packJPG 2.5 plugin

Post by heimaki »

it works here.

you need to copy the runtimes into the main xnview folder, NOT the plugins.

or, compile the source code again and use static linking.

thanks for the nice plugin!
Euphoria
Posts: 14
Joined: Sun May 25, 2014 11:51 pm

Re: packJPG 2.5 plugin

Post by Euphoria »

It's important to note that you should specify this plugin is for packJPG 2.5a. This is important because as of the time of the writing of this comment, packJPG is up to 2.5j (or possibly 2.5k), and each release is reportedly NOT backward compatible. Adding in that "a" to the version information is very important in this case.
heimaki
Posts: 43
Joined: Thu Dec 27, 2012 8:04 pm

Re: packJPG 2.5 plugin

Post by heimaki »

Euphoria wrote:It's important to note that you should specify this plugin is for packJPG 2.5a. This is important because as of the time of the writing of this comment, packJPG is up to 2.5j (or possibly 2.5k), and each release is reportedly NOT backward compatible. Adding in that "a" to the version information is very important in this case.
hm... i tried packjpg 2.5j now, and had no problems with this plugin here. in fact, i even got exacctly the same output (.pjg)

anyway, i also compiled the git code from https://github.com/zingaburga/packJPG-XnView but it was about 3 (!) times slower.

if anyone is interested, i attached a compile (v1.1 from https://github.com/zingaburga/packJPG-XnView/releases) that doesn't need the gcc runtimes mentioned above...
Attachments
Xpjg.rar
(154.55 KiB) Downloaded 242 times
Post Reply