Setting up ImageMagick to work with JPEG-XR format imagery

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

I've been trying to set up ImageMagick to work with the JPEG-XR image format and convert imagery to a more usable format; we need to automate processing of images stored in a database in the format, and it isn't likely that our source will be able to supply the databases with imagery stored in a different format. Ultimately I need this working with the Python Wand binding for ImageMagick, but to start with I should probably just get ImageMagick working with the format.

Thus far I've managed to find and compile copies of jxrlib's JXRDecApp and JXREndApp via Visual Studio, so I have those as executables, but the sum total of documentation for adding support for JPEG-XR seems to be 'Requires the jxrlib delegate library. Put the JxrDecApp and JxrEncApp applications in your execution path.'
I've already tried adding the locations of the JxrDecApp and JxrEncApp executables to the Path system variable, but attempts at converting an example .jxr to .tif format produce the following error:

Code: Select all

C:\>convert testImg.jxr testImg.tif
convert.exe: FailedToExecuteCommand `rename "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268BqVA2y6fQKyx" "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268BqVA2y6fQKyx.jxr"; "@JXRDecodeDelegate@" -i "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268BqVA2y6fQKyx.jxr" -o "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268Lmrf0XLVvPXB.pnm"; rename "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268BqVA2y6fQKyx.jxr" "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268BqVA2y6fQKyx"; rename "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268Lmrf0XLVvPXB.pnm" "C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268Lmrf0XLVvPXB"' (-1) @ error/delegate.c/ExternalDelegateCommand/462.
convert.exe: delegate failed `rename "%i" "%i.jxr"; "@JXRDecodeDelegate@" -i "%i.jxr" -o "%o.pnm"; rename "%i.jxr" "%i"; rename "%o.pnm" "%o"' @ error/delegate.c/InvokeDelegate/1308.
convert.exe: unable to open image `C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268eZ04Cd-kYNYL': No such file or directory @ error/blob.c/OpenBlob/2674.
convert.exe: unable to open module file `C:\Program Files (x86)\ImageMagick-6.9.0-Q16\modules\coders\IM_MOD_RL_JXR_.dll': No such file or directory @ warning/module.c/GetMagickModulePath/672.
convert.exe: unable to open file `C:/Users/RPALIW~1/AppData/Local/Temp/magick-15268eZ04Cd-kYNYL': No such file or directory @ error/constitute.c/ReadImage/540.
convert.exe: no images defined `testImg.tif' @ error/convert.c/ConvertImageCommand/3212.
I'm not entirely sure what's going on here, but I think it likely that I haven't set up JPEG-XR support properly; if this is the case, can someone tell me what I'm doing wrong here?
Alternatively, if this isn't why I'm getting these errors, and ImageMagick is going off to somewhere under Users for a different reason (or this would still be an issue if I did have it set up properly), why is it doing this and what can I do?

I'm sorry if this has been asked before. For some reason the search function on this board doesn't like jxr, JPEG-XR, or jxrlib and queries return no posts, even though I have an example of a previous question asked about the format previously on this board.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by snibgo »

I guess you have put something into delegates.xml. At any rate, that seems to be the problem.
C:\>convert testImg.jxr testImg.tif
convert.exe: FailedToExecuteCommand `rename "C:/Users/RPALIW~1 ...
You are running under Windows, and trying to execute a "rename" command. This doesn't exist for Windows. The equivalent is "ren".
snibgo's IM pages: im.snibgo.com
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

Windows does have a 'rename' command. It's synonymous with 'ren'.
That said, changing delegates.xml mentions of 'rename' to 'ren' does not solve the issue; I am still getting the same error, except for all parts now reading 'ren' instead of 'rename'.

delegates.xml does have an entry for jxr. Do I need to change '@JXRDecodeDelegate@' to the location of JxrDecApp.exe, or is that defined elsewhere? Do I need to find or somehow create IM_MOD_RL_JXR_.dll ?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by dlemstra »

You are correct, you need to change @JXRDecodeDelegate@ to the location of JxrDecApp.exe.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

In delegates.xml, or elsewhere? If I replace it in delegates.xml, it still doesn't solve the issue of the command going off to somewhere entirely different from the supplied file to convert. Is this an entirely different problem?

For instance, I have a .jxr in E: and I'm trying to convert it to .tif format, or something else that should be valid. I use the command 'convert E:\testImg.jxr E:\testImg.tif' at the command prompt.
I still get the error claiming it's trying to rename something in C:/Users/...
Where I have %i and it's supposed to be being replaced with the input image filename (E:/), it instead seems to be being replaced with 'C:/Users/RPALIW~1/AppData/Local/Temp/magick-1956zffRLtArBQU8'

Whereas 'convert download.jpg download.png' works fine and converts properly, so it isn't that ImageMagick is entirely non-functional on this computer.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by dlemstra »

I will take a look at this tonight after work. Can you provide me with a sample image you are using?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

I'm afraid I can't release any of the actual imagery I'm working with. Sorry.
I can give you a random solid-colour JXR created by GIMP, but I'm aware this isn't ideal; if nothing else, I know it's different in some way from the imagery as GIMP doesn't complain about image resolution being out of bounds. I can confirm that this random .jxr created in GIMP fails conversion with the same error message as the actual imagery.

You can get a sample solid-colour JXR confirmed to fail processing here: http://tempsend.com/BBFF4E4925 (for around a week)

Thank you very much for offering to help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by fmw42 »

User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by dlemstra »

It turns out you actually found a bug. Moving files won't work if the file name contains a forward slash and the syntax is different from what you tried so far. I just submitted a patch to our SVN repository to fix this in the next release of ImageMagick (6.9.0-6). You should only need to copy JXRDecApp.exe and JXREncApp.exe to the same folder as convert.exe after you have installed that version.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

I don't mean to sound impatient, but do you have an idea of when the next version of ImageMagick will be released?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by fmw42 »

You can download the beta and install from source. Otherwise, there is no general regular release time. Just whenever the main developer feels like it or there is some important bug fix.
RPaliwoda
Posts: 6
Joined: 2015-02-11T07:37:20-07:00
Authentication code: 6789

Re: Setting up ImageMagick to work with JPEG-XR format imagery

Post by RPaliwoda »

It's working now, somewhat. It now seems to think JXR images (including the sample) are PPM format according to identify, but also it seems to be properly converting them to other formats. Is this something I've done wrong during setup, or do I just need to be put up with it?
I've copied JXRDecApp.exe and JXREncApp.exe to the same location as convert.exe, but JXR doesn't show up in the list of supported formats; is this to be expected?

Thank you very much for your help.
Post Reply