0

I have a file I'm saving in raw GRAY format, which then gets converted to tiff. Running the command as follows works:

convert -size 1024X1024 -depth 16 -endian MSB imgTemp.gray /tmp/bla.tiff

but changing to use stdin as the input doesn't:

cat imgTemp.gray | convert -size 1024x1024 -depth 16 -endian MSB -:gray /tmp/bla.tiff

I get the following error:

convert: no decode delegate for this image format gray' @ error/constitute.c/ReadImage/532. convert: missing an image filename/tmp/bla.tiff' @ error/convert.c/ConvertImageCommand/3011.

The question is why?

NindzAI
  • 570
  • 5
  • 19

1 Answers1

2

You just have the STDIN and format flipped. "-:gray" should be "gray:-"

cat imageTemp.gray | 
  convert -size 1024x1024 \
    -depth 14 \
    -endian MSB gray:- /tmp/bla.tiff

To answer why this is happening. We can run your previous command with a -verbose switch.

cat imgTemp.gray | \
    convert -verbose \
    -size 1024x1024 \
    -depth 16 \
    -endian MSB -:gray /tmp/bla.tiff

This will give use an additional line of information that explains what ImageMagick is trying to do

convert: unable to open image `gray':
  No such file or directory @ error/blob.c/OpenBlob/2638.
convert: no decode delegate for this image format 
 `gray' @ error/constitute.c/ReadImage/550.
convert: no images defined `bla.tiff' @ error/convert.c/ConvertImageCommand/3078.

Convert command becomes confused with -:gray and tries to open a blob file entitled "gray", and eventually attempts to open "bla.tiff" as a source image. Both of them non-existing on the filesystem.

Henk Langeveld
  • 8,088
  • 1
  • 43
  • 57
emcconville
  • 23,800
  • 4
  • 50
  • 66