When Molecular Devices's MetaMorph software exports colorized images in the tiff file format, it creates 8-bit palette color tiffs but neglects to embed the color palette in format that is readable by conventional image viewers. These files have the PhotometricInterpretation
field set to 3
(Palette Color), but are missing a corresponding ColorMap
field. Rather, the color palette is stored as comma-delimited text within the ImageDescription
field.
To view the image using its intended color palette, use ExifTool or a similar utility to extract the palette to a binary lookup table:
# Extract list of color values
values="$( \
exiftool -ImageDescription example.tif \
| sed 's/\.\{2,\}/\n/g' \
| grep 'look-up-table-custom-values' \
| egrep -o '([0-9]|,)*' \
| sed 's/,/ /g' \
)"
# Write binary color values to a new file
for value in $values; do
echo -ne "\x$(printf '%x' "$value")"
done > "example.lut"
Open the image in ImageJ and then load the lookup table via Image → Color → Edit LUT → Open. The grayscale lookup table should be replaced by the palette created by MetaMorph:
A correctly formatted version of the image can then be exported via File → Save As.