Page 1 of 1

6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T13:07:12-07:00
by rbd
Hi all,

I have been successfully using 6.7.9 convert in my processing scripts to convert Sun rasterfiles to JPG on a CentOS system as follows:

> convert xx.ras xx.jpg
> convert --version
Version: ImageMagick 6.7.9-7 2013-08-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

Unfortunately, on an iMac running a recent MacPorts 6.9.5 release this does not work properly:

> convert xx.ras xx.jpg
convert: unable to read image data `xx.ras' @ error/sun.c/ReadSUNImage/471.
convert: no images defined `xx.jpg' @ error/convert.c/ConvertImageCommand/3257.

> convert --version
Version: ImageMagick 6.9.5-10 Q16 x86_64 2016-09-29 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp x xml zlib

I believe that Sun rasterfiles are always big-endian, so I also tried '-endian MSB' (and also '-endian LSB' just for completeness) but got the exact same error as above.

Does anyone know what the problem is here? I have appended some '-debug all' output below.

Thanks!

Roger Davis
Univ. of Hawaii

Output of '-debug all':

> convert -debug all xx.ras xx.jpg
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: utility.c/ExpandFilenames/940/Configure
Command line: convert {-debug} {all} {xx.ras} {xx.jpg}
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/share/ImageMagick-6/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/lib/ImageMagick-6.9.5//config-Q16/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/etc/ImageMagick-6/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/share/doc/ImageMagick-6/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.hmrg-macgtk/ImageMagick/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.config/ImageMagick/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.magick/coder.xml"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Configure convert[79902]: coder.c/LoadCoderCache/826/Configure
Loading coder configuration file "/opt/local/etc/ImageMagick-6/coder.xml" ...
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Module convert[79902]: module.c/OpenModule/1288/Module
Searching for module "SUN" using filename "sun.la"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Module convert[79902]: module.c/GetMagickModulePath/558/Module
Searching for coder module file "sun.la" ...
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Module convert[79902]: module.c/OpenModule/1297/Module
Opening module at path "/opt/local/lib/ImageMagick-6.9.5//modules-Q16/coders/sun.la"
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Module convert[79902]: module.c/OpenModule/1324/Module
Method "RegisterSUNImage" in module "SUN" at address 0x103c1fbd0
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Module convert[79902]: module.c/OpenModule/1338/Module
Method "UnregisterSUNImage" in module "SUN" at address 0x103c21a7f
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Policy convert[79902]: policy.c/IsRightsAuthorized/580/Policy
Domain: Path; rights=Read; pattern="xx.ras" ...
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Blob convert[79902]: blob.c/OpenBlob/2597/Blob
read 3 magic header bytes
2016-10-07T10:04:05-10:00 0:00.000 0.000u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Map: 124MB/118.2MiB/64GiB
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Resource convert[79902]: resource.c/RelinquishMagickResource/1008/Resource
Map: 124MB/0B/64GiB
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Cache convert[79902]: cache.c/DestroyPixelCache/1121/Cache
destroy
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/share/ImageMagick-6/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/lib/ImageMagick-6.9.5//config-Q16/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/etc/ImageMagick-6/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/opt/local/share/doc/ImageMagick-6/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.hmrg-macgtk/ImageMagick/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.config/ImageMagick/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: configure.c/GetConfigureOptions/685/Configure
Searching for configure file: "/Users/rbd/.magick/magic.xml"
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Configure convert[79902]: magic.c/LoadMagicCache/796/Configure
Loading magic configure file "/opt/local/etc/ImageMagick-6/magic.xml" ...
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Policy convert[79902]: policy.c/IsRightsAuthorized/580/Policy
Domain: Coder; rights=Read; pattern="SUN" ...
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Policy convert[79902]: policy.c/IsRightsAuthorized/580/Policy
Domain: Path; rights=Read; pattern="xx.ras" ...
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Blob convert[79902]: blob.c/OpenBlob/2597/Blob
read 3 magic header bytes
2016-10-07T10:04:05-10:00 0:00.010 0.010u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Map: 124MB/118.2MiB/64GiB
2016-10-07T10:04:05-10:00 0:00.020 0.020u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Width: 24KB/24KB/214.7MB
2016-10-07T10:04:05-10:00 0:00.020 0.020u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Height: 20.4KB/20.4KB/214.7MB
2016-10-07T10:04:05-10:00 0:00.020 0.020u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Area: 4.8819GB/4.8819GB/68.719GB
2016-10-07T10:04:05-10:00 0:00.020 0.020u 6.9.5 Resource convert[79902]: resource.c/AcquireMagickResource/313/Resource
Memory: 4.8819GB/4.5466GiB/32GiB
2016-10-07T10:04:05-10:00 0:00.020 0.020u 6.9.5 Cache convert[79902]: cache.c/OpenPixelCache/3870/Cache
open xx.ras[0] (Heap Memory, 23958x20377 4.5466GiB)
2016-10-07T10:04:06-10:00 0:00.550 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/share/ImageMagick-6/locale.xml"
2016-10-07T10:04:06-10:00 0:00.550 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/lib/ImageMagick-6.9.5//config-Q16/locale.xml"
2016-10-07T10:04:06-10:00 0:00.550 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/etc/ImageMagick-6/locale.xml"
2016-10-07T10:04:06-10:00 0:00.550 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/share/doc/ImageMagick-6/locale.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.hmrg-macgtk/ImageMagick/locale.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.config/ImageMagick/locale.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.magick/locale.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Configure convert[79902]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/locale.xml" ...
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/share/ImageMagick-6/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/lib/ImageMagick-6.9.5//config-Q16/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/etc/ImageMagick-6/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/opt/local/share/doc/ImageMagick-6/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.hmrg-macgtk/ImageMagick/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.config/ImageMagick/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Locale convert[79902]: locale.c/GetLocaleOptions/824/Locale
Searching for locale file: "/Users/rbd/.magick/english.xml"
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Configure convert[79902]: locale.c/LoadLocaleCache/1177/Configure
Loading locale configure file "/opt/local/share/ImageMagick-6/english.xml" ...
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Exception convert[79902]: sun.c/ReadSUNImage/471/Exception
unable to read image data `xx.ras'
2016-10-07T10:04:06-10:00 0:00.560 0.530u 6.9.5 Resource convert[79902]: resource.c/RelinquishMagickResource/1008/Resource
Map: 124MB/0B/64GiB
2016-10-07T10:04:06-10:00 0:00.560 0.540u 6.9.5 Cache convert[79902]: cache.c/DestroyPixelCache/1121/Cache
destroy xx.ras[0]
2016-10-07T10:04:06-10:00 0:00.560 0.540u 6.9.5 Resource convert[79902]: resource.c/RelinquishMagickResource/1008/Resource
Memory: 4.8819GB/0B/32GiB
2016-10-07T10:04:06-10:00 0:00.560 0.540u 6.9.5 Exception convert[79902]: convert.c/ConvertImageCommand/3257/Exception
no images defined `xx.jpg'
convert: unable to read image data `xx.ras' @ error/sun.c/ReadSUNImage/471.
convert: no images defined `xx.jpg' @ error/convert.c/ConvertImageCommand/3257.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T13:18:36-07:00
by snibgo
The error in sun.c seems to be that the count of the data read in doesn't match the metadata:

Code: Select all

    if (count != (ssize_t) sun_info.length)
      ThrowReaderException(CorruptImageError,"UnableToReadImageData");
I suggest you upload xx.ras to somewhere so a developer can take a look.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T13:23:28-07:00
by rbd
Thanks snibgo, can you tell me where I should put the file and/or who I should notify?

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T13:33:16-07:00
by snibgo
Upload to somewhere like dropbox.com and paste the URL here.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T14:10:31-07:00
by rbd
Thanks, snibgo! Here's the dropbox link:

https://www.dropbox.com/s/auy6a9uojh1w60z/xx.ras?dl=0

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T14:43:02-07:00
by fmw42
I get on IM 6.9.6.0 Q16 Mac OSX

Code: Select all

identify -verbose xx.ras
identify: unable to read image data `xx.ras' @ error/sun.c/ReadSUNImage/471.

I think one of the IM developers will need to review your file.

But could you not upload a smaller file with the same issue. 125 MB is rather large and takes a while to even have identify finish.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T15:39:36-07:00
by rbd
I will look into creating a smaller file -- unfortunately this is the final product of a rather convoluted processing chain, making a smaller file may take some effort. In the meantime, here is output from my 6.7.9 identify:

> identify --version
Version: ImageMagick 6.7.9-7 2013-08-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

> identify -verbose xx.ras
Image: xx.ras
Format: SUN (SUN Rasterfile)
Class: PseudoClass
Geometry: 23958x20377+0+0
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 32.0896 (0.125842)
standard deviation: 67.3988 (0.264309)
kurtosis: 2.72433
skewness: 2.0177
Green:
min: 0 (0)
max: 255 (1)
mean: 32.0896 (0.125842)
standard deviation: 67.3988 (0.264309)
kurtosis: 2.72433
skewness: 2.0177
Blue:
min: 0 (0)
max: 255 (1)
mean: 32.0896 (0.125842)
standard deviation: 67.3988 (0.264309)
kurtosis: 2.72433
skewness: 2.0177
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 32.0896 (0.125842)
standard deviation: 67.3988 (0.264309)
kurtosis: 2.72433
skewness: 2.0177
Colors: 256
Histogram:
368189658: ( 0, 0, 0) #000000 black
461183: ( 1, 1, 1) #010101 srgb(1,1,1)
461126: ( 2, 2, 2) #020202 srgb(2,2,2)
461163: ( 3, 3, 3) #030303 grey1
... lots of stuff here
459048: (253,253,253) #FDFDFD srgb(253,253,253)
463717: (254,254,254) #FEFEFE srgb(254,254,254)
2864428: (255,255,255) #FFFFFF white
Colormap: 256
0: ( 0, 0, 0) #000000 black
1: ( 1, 1, 1) #010101 srgb(1,1,1)
2: ( 2, 2, 2) #020202 srgb(2,2,2)
3: ( 3, 3, 3) #030303 grey1
... more colormap entries here
253: (253,253,253) #FDFDFD srgb(253,253,253)
254: (254,254,254) #FEFEFE srgb(254,254,254)
255: (255,255,255) #FFFFFF white
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 23958x20377+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2016-10-07T10:57:28-10:00
date:modify: 2016-10-07T10:57:11-10:00
signature: 3fbac225d9856c0d17ca4782f8e131bd59dbd928af064adc16b6a5b19131182d
Artifacts:
filename: xx.ras
verbose: true
Tainted: False
Filesize: 124MB
Number pixels: 488.2M
Pixels per second: 16.11MB
User time: 204.960u
Elapsed time: 0:31.299
Version: ImageMagick 6.7.9-7 2013-08-20 Q16 http://www.imagemagick.org

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T16:03:12-07:00
by rbd
Hi fmw42,

Here's a link to a much smaller file. Behavior is identical -- converts just fine under 6.7.9, but fails under 6.9.5.

https://www.dropbox.com/s/nylc3mmy0duqe ... l.ras?dl=0

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-07T19:31:22-07:00
by fmw42
Thanks. I can read it for versions up to 6.9.4.5 Q16 Mac OSX, but not afterwards. The IM developers will need to check this out.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-08T07:23:14-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-10T14:17:26-07:00
by rbd
Thanks a lot for the quick turnaround! Any idea when the patched code might turn up in a new MacPorts release?

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-10T14:25:51-07:00
by fmw42
Once it comes out in an official release, you may have to ask the MacPorts people to update their release of IM. I have had to do that in the past, since they do not keep up too often with the released versions of Imagemagick. However, once you ask them, they are usually pretty good about getting it upgraded in a timely manner.

Re: 6.9.5 Sun raster to JPG convert failure

Posted: 2016-10-10T14:47:38-07:00
by fmw42
In IM 6.9.6.2 beta, I still get a problem reading the .ras file.

Code: Select all

convert small.ras tmp.jpg
convert: unable to read image data `small.ras' @ error/sun.c/ReadSUNImage/473.
convert: no images defined `tmp.jpg' @ error/convert.c/ConvertImageCommand/3257.