From: lilleyc@cs.man.ac.uk (Chris Lilley)
Newsgroups: comp.lang.postscript
Subject: Level 2 image operator - help needed
Keywords: Level 2 CIELUV image colour color
Date: 13 Nov 92 02:41:35 GMT
Organization: Dept Computer Science, University of Manchester, U.K.

Hi

I am having trouble understanding the Level 2 image operator - the one
operand form that takes a dictionary.

I can use ABC colour spaces OK but when it comes to the image operator
things go wrong. Here is a program that shows what I am doing. It is
all pretty much by the (Big Red) book. What happens is that the 'RGB'
text comes out in colour but the image comes out as a jet black
square.

If anyone can tell me what I am doing wrong I would be grateful.

Chris

======== snip snip ===============================================

%!PS-Adobe-3.0
%	Test out CIE colour space image.

%	Uses CIELUV colour space, prints an image with black (000) at the
%	bottom left, white (100) at top left and 9 intermediate steps of L*

%	U goes from 0 to 56 (out of a range of 127) in the hope of being
%	mostly within the device gamut, in 9 steps.
%	V is constant at 0. So this gives a vertical slice through LUV space
%	from the achromatic axis out along the positive U axis (reds)

%	I should probably used a procedure as datasource but find&replace 
%	was quicker ;-) 

%	Some colours will be out of gamut - the high chroma dark ones - so
%	I wanted to see what happened. Clip to device gamut?

%	Chris Lilley 13 Nov 92 01:08 GMT	lilley@v5.cgu.mcc.ac.uk

%%Pages: 1
%%BeginSetup

%	Set up CIELUV colour space
%	straight from Big Red Book p191

[/CIEBasedABC <<
  /RangeABC [0 100 -128 127 -128 127]
  /DecodeABC [{16 add 116 div} bind {500 div} bind {200 div} bind]
  /MatrixABC [1 1 1 1 0 0 0 0 -1]
  /DecodeLMN
    [{dup 6 29 div ge {dup dup mul mul} 
         {4 29 div sub 108 841 div mul} ifelse 0.9505 mul} bind
     {dup 6 29 div ge {dup dup mul mul} 
         {4 29 div sub 108 841 div mul} ifelse} bind
     {dup 6 29 div ge {dup dup mul mul}
         {4 29 div sub 108 841 div mul} ifelse 1.0890 mul} bind]
  /WhitePoint [0.9505 1 1.0890]	% D65 white point
>>] setcolorspace

%%EndSetup
%%Page: 1 1

/inch {72 mul} def

%	Do some general colour stuff first to test the LUV space works

2 inch 8 inch moveto
/Times-Bold findfont 96 scalefont setfont
50 80 0 setcolor	% a red
(R) show
50 -40 69 setcolor	% a green
(G) show
50 -40 -69 setcolor	% a blue
(B) show
/Times-Bold findfont 30 scalefont setfont
30 0 0 setcolor		% a grey
( - not!) show

%	Now to try the image - first size and place it

2 inch 2 inch translate
4 inch 4 inch scale

%	1 operand image, from Big Red Book p226 but:
%	 less data, and bottom to top ordering
<<
  /ImageType 1
  /Width 8 /Height 11
  /BitsPerComponent 8
  /Decode [0 1 0 1 0 1]
  /ImageMatrix [ 8 0 0 11 0 0]	% left to right, bottom to top
  /DataSource currentfile /ASCIIHexDecode filter
>> image

000000 000800 001000 001800 002000 002800 003000 003800
0A0000 0A0800 0A1000 0A1800 0A2000 0A2800 0A3000 0A3800
140000 140800 141000 141800 142000 142800 143000 143800
1E0000 1E0800 1E1000 1E1800 1E2000 1E2800 1E3000 1E3800
280000 280800 281000 281800 282000 282800 283000 283800
320000 320800 321000 321800 322000 322800 323000 323800
3C0000 3C0800 3C1000 3C1800 3C2000 3C2800 3C3000 3C3800
460000 460800 461000 461800 462000 462800 463000 463800
500000 500800 501000 501800 502000 502800 503000 503800
5A0000 5A0800 5A1000 5A1800 5A2000 5A2800 5A3000 5A3800
640000 640800 641000 641800 642000 642800 643000 643800
>

%	The > is an EOD (end of data) marker (BRB p128) and white space is
%	ignored supposedly

showpage	% Please?
%%Trailer
%%EOF

================= code ends =====================

--
Chris Lilley
---------------------------------------------------------------------------
Technical Author, ITTI Computer Graphics and Visualisation Training Project
Computer Graphics Unit, Manchester Computing Centre, Manchester, UK
Internet:   lilley@cgu.mcc.ac.uk        Janet:   lilley@uk.ac.mcc.cgu
Voice:      +44 (0)61 275 6095          Fax:     +44 (0)61 275 6040
---------------------------------------------------------------------------
Newsgroups: comp.lang.postscript