Discover proprietary raster format?
Discover proprietary raster format?
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
Many thanks - Mark
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Discover proprietary raster format?
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.
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.
snibgo's IM pages: im.snibgo.com
Re: Discover proprietary raster format?
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!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Discover proprietary raster format?
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
snibgo's IM pages: im.snibgo.com
Re: Discover proprietary raster format?
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Discover proprietary raster format?
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.
convert yourfile.suffix newfile.png
where you replace yourfile.suffix with your existing real file name and suffix.
Re: Discover proprietary raster format?
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
Thanks - Mark
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Discover proprietary raster format?
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
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?
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Discover proprietary raster format?
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.
You could also try
convert -list delegates
and see if the line starting with DELEGATES shows more delegates.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Discover proprietary raster format?
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:
This will show whether dcraw is installed and, if it is, whether it can read the file.
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
snibgo's IM pages: im.snibgo.com
Re: Discover proprietary raster format?
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!
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!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Discover proprietary raster format?
My mistake. Should beC:\Program Files\ImageMagick-6.9.1-Q16>convert -list delegates
convert -list configure
then look at line starting with DELEGATES
Re: Discover proprietary raster format?
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""/>
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""/>
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Discover proprietary raster format?
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
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.
snibgo's IM pages: im.snibgo.com