PostScript error with imagemask and raw data

322 views Asked by At

In Adobe's PLRM I found the following example using the imagemask operator. This works fine when running with Ghostscript.

54 112 translate               % Locate lower-left corner of square
120 120 scale                  % Scale 1 unit to 120 points
0 setgray                      % Set current color to black
24 23                          % Specify dimensions of source mask
true                           % Set polarity to paint the 1 bits
[24 0 0 -23 0 23]              % Map unit square to mask
{< 003B00 002700 002480 0E4940
   114920 14B220 3CB650 75FE88
   17FF8C 175F14 1C07E2 3803C4
   703182 F8EDFC B2BBC2 BB6F84
   31BFC2 18EA3C 0E3E00 07FC00
   03F800 1E1800 1FF800 >}
imagemask
showpage

As an exercise I tried to rewrite the above example using an ImageType-1 dictionary and raw data, and finally came up with this code:

54 112 translate
120 120 scale
0 setgray
<<
  /ImageType 1
  /Width 24
  /Heigth 23
  /BitsPerComponent 1
  /Decode [1 0]
  /ImageMatrix [24 0 0 -23 0 23]
  /DataSource currentfile /ASCIIHexDecode filter
>>
imagemask
003B00 002700 002480 0E4940
114920 14B220 3CB650 75FE88
17FF8C 175F14 1C07E2 3803C4
703182 F8EDFC B2BBC2 BB6F84
31BFC2 18EA3C 0E3E00 07FC00
03F800 1E1800 1FF800>
showpage

However, when running this with Ghostscript I get the following error.

Error: /undefined in --imagemask--

I'm still scratching my head to find the bug, but in vain. How can it be imagemask is undefined? Or did I miss something obvious?

1

There are 1 answers

0
KenS On BEST ANSWER

I don't know if this is exactly the code you've written, but there's a typo:

  /Heigth 23

which should obviously be:

  /Height 23

If I correct that, the file runs to completion, and draws the turkey.