Page 1 of 2

Discover proprietary raster format?

Posted: 2015-06-24T06:11:51-07:00
by courtejm
I've got a number of images in a proprietary black&white (presumably grayscale) raster format that I would dearly like to be able to display/convert. Is there any way ImageMagick can be used (scripted?) to try and discover the format, i.e. experiment with various values for the number of pixels per line, bytes per pixel, header length etc. Once the correct values have been applied, the image should be recognizable. All of the images are exactly 260,452 bytes.
Many thanks - Mark

Re: Discover proprietary raster format?

Posted: 2015-06-24T06:31:57-07:00
by snibgo
If the files are the same size, this suggests there is no compression, so the job may be simple.

A hex dump may show whether the data is 1 or 2 bytes/channel/pixel, and how many channels, and maybe whether pixel lines are padded. It may also show the length of the initial header. If there is no trailer, that gives the number of pixels.

Non-IM tools can strip header and trailer.

Pixels can be fed as raw data into IM at varous guesses for width and height.

Re: Discover proprietary raster format?

Posted: 2015-06-24T06:56:22-07:00
by courtejm
IM seems to require a file extension in order to handle the image in the correct way. Any suggestions as to what to use? Is dcraw the correct delegate program? Thanks!

Re: Discover proprietary raster format?

Posted: 2015-06-24T07:07:36-07:00
by snibgo
Sorry, I assumed you had already tried using IM directly. IM will try to identify the file format, if it can, from magic bytes at the start of the file. If the file is named "abc", try:

Code: Select all

identify abc

convert abc x.png

Re: Discover proprietary raster format?

Posted: 2015-06-24T07:20:11-07:00
by courtejm
C:\Program Files\ImageMagick-6.9.1-Q16>identify abc
identify.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.

C:\Program Files\ImageMagick-6.9.1-Q16>convert abc x.png
convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert.exe: no images defined `x.png' @ error/convert.c/ConvertImageCommand/3212.

Re: Discover proprietary raster format?

Posted: 2015-06-24T09:02:07-07:00
by fmw42
abc is just an example name. use a real file name

convert yourfile.suffix newfile.png

where you replace yourfile.suffix with your existing real file name and suffix.

Re: Discover proprietary raster format?

Posted: 2015-06-24T09:24:57-07:00
by courtejm
It really is called abc! I renamed it from 20140616.001 which was the original file name (the suffix doesn't seem to be intended to give any indication of the file format, i.e. .001, .002, .003 etc. for images generated on the same day)
Thanks - Mark

Re: Discover proprietary raster format?

Posted: 2015-06-24T09:34:07-07:00
by fmw42
Sorry if this repeats what snibgo has suggested above.

Perhaps it is a raw image. See http://www.imagemagick.org/Usage/formats/#crw. Raw images need the dcraw (or ufraw?) delegate library. I do not know if it is included in the IM distribution.

The string format as follows can often identify the image format

convert abc -format "%m" info:

P.S. Where did you get the file? That could be useful to help identify what format it is?

Also what version of IM are you using? Looks like you are on Windows.

What delegates do you have installed? Post the list from

convert -version

Re: Discover proprietary raster format?

Posted: 2015-06-24T10:39:30-07:00
by courtejm
The file is from a Fluoroscan Premier 60000 "Mini C-arm" X-ray machine. The machine is no longer supported by the manufacturer and the tech support staff are unable to provide information about the file format.

It is the Windows version. There is a file dcraw.exe in the directory.

C:\Program Files\ImageMagick-6.9.1-Q16>convert abc -format "%m" info:
convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert.exe: no images defined `info:' @ error/convert.c/ConvertImageCommand/3212.

C:\Program Files\ImageMagick-6.9.1-Q16>convert -version
Version: ImageMagick 6.9.1--6 Q16 x64 2015-06-20 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

Thanks

Re: Discover proprietary raster format?

Posted: 2015-06-24T10:52:30-07:00
by fmw42
I do not see dcraw in the list of delegates. But that is not always accurate regarding delegates. A Windows user, such as snibgo, would know more about how to test if dcraw is configured for IM.

You could also try

convert -list delegates

and see if the line starting with DELEGATES shows more delegates.

Re: Discover proprietary raster format?

Posted: 2015-06-24T11:00:00-07:00
by snibgo
If you put two sample files somewhere like dropbox.com and paste URLs here, someone might take a look. (Two files will help to identify a header.)

dcraw is for camera formats. X-ray equipment is unlikely to use one of these. But that is easily tested:

Code: Select all

dcraw abc
This will show whether dcraw is installed and, if it is, whether it can read the file.

Re: Discover proprietary raster format?

Posted: 2015-06-24T12:31:37-07:00
by courtejm
https://www.dropbox.com/s/wc2v7qvl7h7z9 ... 6.001?dl=0
https://www.dropbox.com/s/zls15e9dh3jkj ... 3.002?dl=0

C:\Program Files\ImageMagick-6.9.1-Q16>dcraw abc
Cannot decode file abc

C:\Program Files\ImageMagick-6.9.1-Q16>convert -list delegates
convert.exe: unrecognized list type `delegates' @ error/convert.c/ConvertImageCommand/2025.

Thanks again!

Re: Discover proprietary raster format?

Posted: 2015-06-24T12:51:32-07:00
by fmw42
C:\Program Files\ImageMagick-6.9.1-Q16>convert -list delegates
My mistake. Should be

convert -list configure

then look at line starting with DELEGATES

Re: Discover proprietary raster format?

Posted: 2015-06-24T13:17:24-07:00
by courtejm
C:\Program Files\ImageMagick-6.9.1-Q16>convert -list configure

Path: [built-in]

Name Value
-------------------------------------------------------------------------------
FEATURES OpenMP
NAME ImageMagick
QuantumDepth 16

Path: C:\Program Files\ImageMagick-6.9.1-Q16\configure.xml

Name Value
-------------------------------------------------------------------------------
CC vs10
COPYRIGHT Copyright (C) 1999-2015 ImageMagick Studio LLC
DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
FEATURES OpenMP
HOST Windows
LIB_VERSION 0x691
LIB_VERSION_NUMBER 6,9,1,7
NAME ImageMagick
RELEASE_DATE 2015-08-15
VERSION 6.9.1
WEBSITE http://www.imagemagick.org

C:\Program Files\ImageMagick-6.9.1-Q16>identify abc.raw
Cannot decode file C:/Users/mark/AppData/Local/Temp/magick-73482wRIYn8h545s
identify.exe: delegate failed `dcraw.exe -6 -w -O "%u.ppm" "%i"' @ error/delegate.c/InvokeDelegate/1332.
identify.exe: unable to open image `C:/Users/mark/AppData/Local/Temp/magick-7348DMzTQjXgBBXN.ppm': No such file or directory @ error/blob.c/OpenBlob/2697.

C:\Program Files\ImageMagick-6.9.1-Q16>find "dcraw" delegates.xml

---------- DELEGATES.XML
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -w -O "%u.ppm" "%i""/>

Re: Discover proprietary raster format?

Posted: 2015-06-24T13:47:32-07:00
by snibgo

Code: Select all

tail --bytes=+800 20140616.001 | convert -size 556x467 -depth 8 gray:- xray1.png

tail --bytes=+800 20141013.002 | convert -size 556x467 -depth 8 gray:- xray2.png
Image
Image

The offset (800 bytes) is wrong, which creates a "horizontal hold" problem. I don't know if the images are supposed to reappear at the bottom, or if these are separate thumbnail images.