I have a raw file but I don't know the pixel format or the width of the image. I need a tool that can quickly display the data and allow me to try different formats easily. An example of such a tool for Windows would be 7yuv. What software exists for this task on Linux?
Note: This has nothing to do with digital camera raws, which is frustrating my attempts to use Google to answer this question.
Turns out Gimp can do this. Just open the file as raw, and you get this helpful dialog that allows you to preview the image:
convert
from ImageMagickE.g., an 8-bit 2x3 grayscale:
Then:
Command explanation:
-depth 8
: each color has 8 bits-size 2x3+0
:2x3
image.+0
means starting at offset 0 in the file. If there are metadata headers, you can skip them with the offset.gray:in.bin
: the input file isin.bin
, and the format isgray
, as defined at http://www.imagemagick.org/script/formats.php This weird notation is used because ImageMagick usually determines the format from the extension, but here there is no extension.How to view such tiny outputs like this example
The problem now is how to view the such a tiny 3x2 output accurately. A direct
eog
:is not very good because the image is too small, and if you zoom in a lot
eog
uses a display algorithm that mixes up pixels continuously, which is better for most pictures, but not for such a tiny image.One good possibility is to run:
or directly in one go with:
-scale
is needed instead of-resize
, since-resize
mixes pixel colors continuously up much likeeog
by default.Output:
Anther option is to view it in Gimp:
Image editors such as Gimp must show every single pixel separately if you zoom in enough.
RGB example
or with the
-scale
to make it more viewable:Related:
Tested on Ubuntu 16.04, ImageMagick 6.8.9.
this python snippet does it: