You are here

JPEG 2000

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

The wavelet/JPEG 2000 plug-in, written by Divyanshu Vats, from the 2006 GIMP Google Summer of Code wavelet project, mentored by Simon Budig.

It creates three plug-ins:
jp2: JPEG 2000 support
denoise: A noise removal plug-in
ihalf: Inverse halftoning -- remove halftones from printed images.

It requires the openjpeg library, available at: http://www.openjpeg.org/

I'm not sure what the license is (the code files don't say) but the COPYING file looks pretty free.

AttachmentSize
jp2.tar.gz989.86 KB
GIMP Version: 

Comments

plugin segfaults with openjpeg v1.2

The plugin is delivered with it's own copy of the openjpeg.h header.

The structures have changed, and certain things are much larger.

Remove the local openjpeg.h header, add the following to src/main.h:

#ifndef MAX_PATH
#define MAX_PATH
#endif

and the plug-in will build and not segfault.

My first rendered image was a bit ugly, but at least it didn't segfault...

I tried to build this source under Debian 4.0 (x86) and it did not work. I've found another one: http://advance-software.com/download/tools/gimp_j2k.zip After compiling, this one was already working, but it suffered from two problems: - it opened only files with J2K container (rarely used), so opening jp2 files from many other programs wasn't successful - save quality was lossless without any option to change it I tried to fix these two problems in a maximum lazy way here: http://cid-5c7afa1d9502f86f.skydrive.live.com/self.aspx/gimp-jp2/gimp%7C... - with these fixes you can interchange jp2 files between LuraWave (XnView), LEAD (Photoshop), FNord (Photohop), FastStone (and probably others). JP2 container is used for reading. - if you append qlxx (where xx is between 00 and 99) at the end of the filename of the saved image, eg. imgp0777.jp2 will be imgp0777ql75.jp2, the file will be saved lossy in 75% quality. I didn't encounter any problems during my short tests with it. The archive contains only two modified files as the replacement in the original archive above. To build it, I had to symlink libopenjpeg-2.1.3.0.so to liblibopenjpeg.so (problem of the original archive). Alternatively, you can try to use my x86 binary included. Be sure you have libopenjpeg correctly installed. Simply copy the binary into your gimp plug-in directory and it COULD work.

The license of this code is unclear to me (COPYING is rather generic, and some of the source files do not contain any reference).

We should try to solve this.

Is good, but the original files has some overflow bugs that leaves wrong colors. I had fixed it some time ago, and compiled it for Windows: http://deebuv.wordpress.com/2006/08/11/saving-jp2-images/#comments This is the link with the Windows exe and sourcecode without this bug: http://www.megaupload.com/?d=BANPHKD6 I am not a good programmer, but this sourcecode could be useful to fix the overflow bug.

I tried your Windows binary, pucelo, then I recompiled it without console windows and debug code (100 Mb instead of 500). I had to modify the .Po files in .deps for they all refer to an H:/ drive in your machine ;) Well, it works, but there is still the same bug as in the original version (indeed, I did not see the differences: exactly same executable size and same behavior, but I didn't try for a long time): In both versions the compression rate slider is set to 100. If you save the image without moving it, it makes a gray empty image. If you move the slider and go back to 100 it makes a very compressed yet not so bad image: a 3.5 Mb lossless JP2 is saved as a 90 Kb file. I initialized the compression rate so that you need not to move the slider, but I haven't done C programming for 15 years, and I never was a good C programmer. I added one line here: /* Get other parameters from interface */ parameters.numresolution = 6; rate = 0; dialog(&rate); parameters.tcp_rates[0] = rate; The bug seems to be fixed (image size with zero rate seems to be almost the same size as my lossless test image), but I'm afraid I should have initialized the variable elsewhere, since I forgot almost everything about C... [Edited] I also noticed that if I wanted to type the JP2 extension in uppercase, the plugin would crash. So I added: static const char *extension[] = { "pgx", "pnm", "pgm", "ppm", "bmp", "j2k", "jp2", "jpt", "PGX", "PNM", "PGM", "PPM", "BMP", "J2K", "JP2", "JPT" }; Not very proud of this (if someone writes "Jp2", I suppose it will crash, too. As for the rate statement, I finally wrote: if (rate < 0 || rate > 100) rate = 0; But the slider always starts at zero, which proves that the variable is out of bounds every time the program starts. I retrieved my old C reference manual, mouldy, ill-smelling, dated 1990... [...later] I read one page of the ill-smelling manual, and I removed my uppercase constants. Just wrote: if (strnicmp (ext, extension[i], 3) == 0) instead of if (strncmp (ext, extension[i], 3) == 0) Same issue in jp2read. Same remedy. The Linux source should be modified too: if (strncasecmp (ext, extension[i], 3) == 0) Another small bug: if you try to save a multi-layer image, the error is not handled and the plugin crashes. François Collard

1. Much better to remove the length of the comparison completely, e.g. use 'strcasecmp', see http://www.opengroup.org/onlinepubs/000095399/functions/strcasecmp.html :

if ( strcasecmp(ext, extension[i]) == 0 )

2. If your windows compiler doesn't have strcasecmp, then it probably has stricmp (check your doco), so add this to a header file (which is #included by the module) somewhere:

#ifdef _WIN32
#define strcasecmp(a,b) stricmp((a),(b))
#endif

3. Finally, in your list of extensions, you can add "jpeg" - note that this is a 4-letter extension.

1 Please you may explain better the content of that pack? Fix-CA is another build of this Gimp plugin (win binary here http://photocomix-resources.deviantart.com/art/Fix-Cromatic-Aberration-9... source code and links for other binary on http://kcd.sourceforge.net/fix-ca.php )that has same name or something different? If the last which are the differences? 2 You upload on megaupload but their service is awful for all the ads and more for the long wait they impose to not paying cunstomers...i suggest (i'm not affiliate with the side) instead the free option of www.box net (10mb limit for each upload till 1GB of free usable space) that do no display adds and do no force to long wait.
Subscribe to Comments for "JPEG 2000"