Page 1 of 1

JPEG XR delegate configuration is broken [with patch]

Posted: 2014-07-08T12:40:38-07:00
by njdoyle
The JPEG XR delegates seem to be misconfigure in a few ways.

Firstly, variables in configure and configure.ac seem to have an accidental extra typo 'M'.
'JXRMEncodeDelegateDefault' should be 'JXREncodeDelegateDefault'.
This makes it so JPEG XR delegates don't get added when ./configure is run.
I've fixed this in the attached patch.

Secondly, in delegates.xml.in, PNM files are being sent to JxrEncApp and JxrDecApp. These two delegates aren't particularly smart and only really like BMP files, they might even require to be named as such.
This makes conversions to/from JPEG XR fail.
I've fixed this in the supplied patch.

Thirdly, this delegate configuration doesn't account for the -quality option being sent to convert, only lossless JPEG XR images will be made because of this. I didn't find documentation on how to do pass quality settings to delegates so I didn't fix this in the patch.

Lastly, once delegation is set up and working properly. Piping in a JPEG XR image over STDIN fails thusly:

Code: Select all

$ cat Example.jxr | convert JXR:- Example.png 
mv: /var/tmp/magick-285531ixogLB5CY6G.bmp: No such file or directory
convert: delegate failed `mv "%i" "%i.jxr"; "JxrDecApp" -i "%i.jxr" -o "%o.bmp" -c 0; mv "%i.jxr" "%i"; mv "%o.bmp" "%o"' @ error/delegate.c/InvokeDelegate/1153.
convert: unable to open image `/var/tmp/magick-285535YnakKu7Fxk3': No such file or directory @ error/blob.c/OpenBlob/2658.
convert: unable to open file `/var/tmp/magick-285535YnakKu7Fxk3': No such file or directory @ error/constitute.c/ReadImage/540.
convert: no images defined `Example.png' @ error/convert.c/ConvertImageCommand/3187.
I have not addressed this in the attached patch.

Here's the patch for part 1 and 2 against ImageMagick-6.8.9-5:

Code: Select all

diff -rupN ImageMagick-6.8.9-5.old/config/delegates.xml.in ImageMagick-6.8.9-5/config/delegates.xml.in
--- ImageMagick-6.8.9-5.old/config/delegates.xml.in	2014-05-16 10:06:13.000000000 -0400
+++ ImageMagick-6.8.9-5/config/delegates.xml.in	2014-07-08 13:34:39.000000000 -0400
@@ -103,8 +103,8 @@
   <delegate decode="plt" command=""@EchoDelegate@" "set size 1.25,0.62; set terminal postscript portrait color solid; set output \'%o\'; load \'%i\'" > "%u";"@GnuplotDecodeDelegate@" "%u""/>
   <delegate decode="png" encode="webp" command=""@WebPEncodeDelegate@" -quiet -q %Q "%i" -o "%o""/>
   <delegate decode="pnm" encode="ilbm" mode="encode" command=""@ILBMEncodeDelegate@" -24if "%i" > "%o""/>
-  <delegate decode="pnm" encode="jxr" command="mv "%i" "%i.pnm"; "@JXREncodeDelegate@" -i "%i.pnm" -o "%o.jxr"; mv "%i.pnm" "%i"; mv "%o.jxr" "%o""/>
-  <delegate decode="pnm" encode="wdp" command="mv "%i" "%i.pnm"; "@JXREncodeDelegate@" -i "%i.pnm" -o "%o.jxr"; mv "%i.pnm" "%i"; mv "%o.jxr" "%o""/>
+  <delegate decode="bmp" encode="jxr" command="mv "%i" "%i.bmp"; "@JXREncodeDelegate@" -i "%i.bmp" -o "%o.jxr"; mv "%i.bmp" "%i"; mv "%o.jxr" "%o""/>
+  <delegate decode="bmp" encode="wdp" command="mv "%i" "%i.bmp"; "@JXREncodeDelegate@" -i "%i.bmp" -o "%o.jxr"; mv "%i.bmp" "%i"; mv "%o.jxr" "%o""/>
   <delegate decode="pov" command=""@POVDelegate@" "+i%i" -D0 "+o%o" +fn%q +w%w +h%h +a -q9 "-kfi%s" "-kff%n";"@ConvertDelegate@" -concatenate "%o*.png" "%o""/>
   <delegate decode="ppt" command=""@DOCDecodeDelegate@" --headless --convert-to pdf --outdir `dirname "%i"` "%i" 2> "%Z"; mv "%i.pdf" "%o""/>
   <delegate decode="pptx" command=""@DOCDecodeDelegate@" --headless --convert-to pdf --outdir `dirname "%i"` "%i" 2> "%Z"; mv "%i.pdf" "%o""/>
@@ -124,7 +124,7 @@
   <delegate decode="svg:decode" stealth="True" command=""@SVGDecodeDelegate@" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
   <delegate decode="tiff" encode="launch" mode="encode" command=""@LaunchDelegate@" "%i""/>
   <delegate decode="txt" encode="ps" mode="bi" command=""@TXTDelegate@" -o "%o" "%i""/>
-  <delegate decode="wdp" command="mv "%i" "%i.jxr"; "@JXRDecodeDelegate@" -i "%i.jxr" -o "%o.pnm"; mv "%i.jxr" "%i"; mv "%o.pnm" "%o""/>
+  <delegate decode="wdp" command="mv "%i" "%i.jxr"; "@JXRDecodeDelegate@" -i "%i.jxr" -o "%o.bmp"; mv "%i.jxr" "%i"; mv "%o.bmp" "%o""/>
   <delegate decode="webp" command=""@WebPDecodeDelegate@" -pam "%i" -o "%o""/>
   <delegate decode="wmf" command=""@WMFDecodeDelegate@" -o "%o" "%i""/>
   <delegate decode="xls" command=""@DOCDecodeDelegate@" --headless --convert-to pdf --outdir `dirname "%i"` "%i" 2> "%Z"; mv "%i.pdf" "%o""/>
diff -rupN ImageMagick-6.8.9-5.old/configure ImageMagick-6.8.9-5/configure
--- ImageMagick-6.8.9-5.old/configure	2014-06-30 07:32:25.000000000 -0400
+++ ImageMagick-6.8.9-5/configure	2014-07-08 13:29:41.000000000 -0400
@@ -32771,7 +32771,7 @@ HTMLDecodeDelegateDefault='html2ps'
 ILBMDecodeDelegateDefault='ilbmtoppm'
 ILBMEncodeDelegateDefault='ppmtoilbm'
 JXRDecodeDelegateDefault='JxrDecApp'
-JXRMEncodeDelegateDefault='JxrEncApp'
+JXREncodeDelegateDefault='JxrEncApp'
 LPDelegateDefault='lp'
 LPRDelegateDefault='lpr'
 LaunchDelegateDefault='gimp'
diff -rupN ImageMagick-6.8.9-5.old/configure.ac ImageMagick-6.8.9-5/configure.ac
--- ImageMagick-6.8.9-5.old/configure.ac	2014-06-23 21:09:59.000000000 -0400
+++ ImageMagick-6.8.9-5/configure.ac	2014-07-08 13:29:56.000000000 -0400
@@ -3210,7 +3210,7 @@ HTMLDecodeDelegateDefault='html2ps'
 ILBMDecodeDelegateDefault='ilbmtoppm'
 ILBMEncodeDelegateDefault='ppmtoilbm'
 JXRDecodeDelegateDefault='JxrDecApp'
-JXRMEncodeDelegateDefault='JxrEncApp'
+JXREncodeDelegateDefault='JxrEncApp'
 LPDelegateDefault='lp'
 LPRDelegateDefault='lpr'
 LaunchDelegateDefault='gimp'

Re: JPEG XR delegate configuration is broken [with patch]

Posted: 2014-07-18T13:26:04-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-6 Beta, available by sometime tomorrow. Thanks.