MP feature suggestion: support for JPEG 2000

Bugs and Suggestions in XnView MP or XnConvert MP which have been resolved.

Moderators: helmut, XnTriq, xnview

*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

Support for JPEG 2000 is useful in many cases. For example, JPEG 2000 is very useful for scanned pages from books and photos (but of course it may be useful for many other things). For now it is impossible to open .jp2 files with XnViewMP so I can't for example use XnViewMP to inspect/view images I have scanned and I can't view my photos :( (in my case using simple JPEG is not an option not only because it uses too much space and adds very distracting artifacts but also because I have a large amount of .jp2 files already including 50000+ of photos - I'm using JPEG 2000 for relatively long time). Is there any hope to see support for JPEG 2000 in XnViewMP in near future :) ?
User avatar
xnview
Author of XnView
Posts: 37889
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: MP feature suggestion: support for JPEG 2000

Post by xnview »

JPEG200 is already supported (with the plugin)
Pierre.
*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

Re: MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

Great! But where I can find this plug-in? I've searched with Google before creating this thread and to be sure I have tried again with different keywords - didn't find anything :( . I would really appreciate if you point me in the right direction to where I can find this plug-in.
User avatar
xnview
Author of XnView
Posts: 37889
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: MP feature suggestion: support for JPEG 2000

Post by xnview »

*Dark Dragon* wrote:Great! But where I can find this plug-in? I've searched with Google before creating this thread and to be sure I have tried again with different keywords - didn't find anything :( . I would really appreciate if you point me in the right direction to where I can find this plug-in.
Do you have XJp2.dll in the Plugins folder?
Pierre.
*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

Re: MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

xnview wrote:Do you have XJp2.dll in the Plugins folder?
I have Xjp2.so (with small "j") in my Plugins folder (I'm using Linux). But how do I use this plug-in? XnViewMP does not recognize any .jp2 files as images. For example, if I go to any folder with .jp2 images (or .JP2) with setting View->Filter By->All I get "blank" icons (same that are used for all unknown formats) for all .jp2 files, and XnViewMP refuses to open them if I double-click on any of .jp2. If I set View->Filter By->Images XnViewMP hides all .jp2 files (only shows images in other formats). In other words, XnViewMP does not think that .jp2 is an image format: in Help->About->Formats there are only "JPEG / JFIF" and "JPEG 8BIM header (Mac)" but there are no JPEG 2000 or JP2. I even tried to add path to Plugins folder to LD_LIBRARY_PATH in xnview.sh but it didn't change anything. Any idea what's wrong?
User avatar
XnTriq
Moderator & Librarian
Posts: 6040
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: MP feature suggestion: support for JPEG 2000

Post by XnTriq »

Under Windows, there is a text file called qt.conf in the program directory telling XnView where to look for the plug-ins:

Code: Select all

[Paths]
Plugins = plugins
Maybe this is needed for Linux too?
obelisk
Posts: 438
Joined: Fri Jan 09, 2009 9:54 am

Re: MP feature suggestion: support for JPEG 2000

Post by obelisk »

wierd thing is what 12yrs after jp2, still almost NOTHING supports it out of box.
what's the point of it? From my tests, it's a tiny bit better than jpg at same filesize. But w/o browser support etc, I wouldn't consider using it.
*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

Re: MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

After using strace to understand this situation I have found that the problem is that XnViewMP even does not try to load Xjp2.so at all. In fact, it looks like XnViewMP does not know that Xjp2.so can exist so XnViewMP does not try to do anything with Xjp2.so. Below I explain how I found this fact. But to fix this it is necessary to fix XnViewMP and make it load Xjp2.so (for now XnViewMP only opens rwz_sdk.so).

First I have tried to create qt.conf and XnViewMP does find and open it:

Code: Select all

% dirname="`pwd`"
% export LD_LIBRARY_PATH="$dirname"/lib
% export QT_PLUGIN_PATH="$dirname"/lib
% strace ./xnview /mnt/sdd2/Books/scan-small.JP2 |& grep -i 'qt.conf' | sort | uniq
open("/var/pkgs/xnview/XnViewMP-032/qt.conf", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 5
stat64("/var/pkgs/xnview/XnViewMP-032/qt.conf", {st_mode=S_IFREG|0644, st_size=26, ...}) = 0
But this does not change anything :( (of course I used "Plugins = Plugins" in qt.conf because plug-ins are in Plugins directory: Linux filesystem is case-sensitive). XnViewMP still cannot recognizes .jp2 files as images. Original xnview.sh sets QT_PLUGIN_PATH to lib and not to Plugins so I tried

Code: Select all

export QT_PLUGIN_PATH="$dirname"/Plugins
instead of

Code: Select all

export QT_PLUGIN_PATH="$dirname"/lib
but this didn't change anything either :( . So I ran this command (in environment set by original xnview.sh without any change) and got the following output

Code: Select all

% strace ./xnview /mnt/sdd2/Books/scan-small.jp2 |& grep Plugins
open("/var/pkgs/xnview/XnViewMP-032/Plugins/IlmImf.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/var/pkgs/xnview/XnViewMP-032/Plugins/rwz_sdk.so", O_RDONLY) = 10
open("/var/pkgs/xnview/XnViewMP-032/Plugins/webp.so", O_RDONLY) = -1 ENOENT (No such file or directory)
As you can see XnViewMP tried to open three plugins and only one existed: rwz_sdk.so. It didn't even try to open existing Xjp2.so in Plugins folder. And trying to set qt.conf or QT_PLUGIN_PATH to Plugins instead of lib gives nothing useful - it looks like XnViewMP simply does not know that Xjp2.so even can exist as you can see from the above output.
*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

Re: MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

obelisk wrote:wierd thing is what 12yrs after jp2, still almost NOTHING supports it out of box. ... But w/o browser support etc, I wouldn't consider using it.
Not true. JPEG 2000 works for me out of the box almost everywhere. ImageMagick supports it out of the box, Gwenview also supports it (that's default image viewer in KDE), okular and many other programs. Only programs where JPEG 2000 does not work out of the box for me are browsers and GIMP but fortunatelly there are plug-ins that add this support. May be some day popular browsers will support it without additional plug-in but I really do not see how this is relevant, especially for personal file collection.
what's the point of it? From my tests, it's a tiny bit better than jpg at same filesize.
Then your tests were wrong. For me difference is extreme. Some images look very blurry in JPEG format even with 100% quality (yes, JPEG is so broken that even 100% quality is very far from acceptable quality for some images containing a lot of high-frequency details). However with JP2 format such images look almost perfect in 85%-90% quality. For such images JP2 files are many times smaller than JPEG and have much better quality - quality that is imposable to achieve even in JPEG of 100% quality. Without JP2 I would have to use something like PNG and waste unimaginable amount of disk space because I have a lot of high-resolution images that are not possible to save in JPEG format without ruining them (and even worse, with JPEG I would have to waste time choosing optimal "quality" setting for every image before I can save it; JP2 have very predictable and intuitive quality loss in 20%-100% range but JPEG can lose a lot of quality even at 100% "quality" and that's hard to predict: some images look good in JPEG of average "quality" and some are ruined by JPEG of 100% "quality"). Even for images like gray scan of BW book JP2 wins: at quality level of 20%-80% JP2 tends to lose only (or mostly) low-contrast background noise and leaves letters and pictures very sharp, and with some experience of using JP2 you can easily know optimal quality setting for a book you scanning. But JPEG adds a lot of artifacts and blurs everything especially at low quality setting because it "thinks" that low-contrast high-frequency noise is important. These shortcomings of JPEG format are the reason why JP2 was created.

I really wouldn't post such a long answer to you obelisk (because your message is irrelevant for this particular topic) but some people (including those who may find this topic in Google) may mistakenly think from your post that support for JP2 is not important or that JP2 is not useful. Yes, there are situations when JPEG is useful - for example, for web-sites but only because browsers do not have built-in support for JP2 yet.

And please do not post irrelevant messages. This topic is about XnViewMP having a problem to open JP2 files in Linux, not about discussing JP2 usefulness or importance.
User avatar
xnview
Author of XnView
Posts: 37889
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: MP feature suggestion: support for JPEG 2000

Post by xnview »

*Dark Dragon* wrote:
xnview wrote:Do you have XJp2.dll in the Plugins folder?
I have Xjp2.so (with small "j") in my Plugins folder (I'm using Linux). But how do I use this plug-in?
Ok, there is a problem on linux
Pierre.
*Dark Dragon*
Posts: 8
Joined: Sat Dec 11, 2010 11:35 pm

Re: MP feature suggestion: support for JPEG 2000

Post by *Dark Dragon* »

It works in new version of XnViewMP. Thank you very much.