Search code examples
postscript

image represented as radix number in postscript


I would like to achive the same as this:

4 1 1 [1 0 0 1 0 0] {<4>} image

but using radix representation:

4 1 1 [1 0 0 1 0 0] 2#0100 image %this one does not work

Solution

  • Have a look at the PostScript Reference Manual:

    image width height bits/sample matrix datasrc image

    [...]

    In LanguageLevel 1, datasrc must be a procedure. In LanguageLevel 2 or 3, it may be any data source—a procedure, a string, or a readable file, including a filtered file (see Section 3.13, “Filtered Files Details”).

    2#0100 is a number, but you need to supply a procedure, string or file. There is no binary representation of strings, so you would have to implement your own conversion from a "binary string" to a "normal", hexadecimal or base-85 string.