Accurate Image Manipulation for Desktop Publishing 
Calibration


PostScript Calibration Hack

    This information was kindly provided by Mr. Christian Brechbuehler  ttp://www.vision.ee.ethz.ch/~brech/docu/postscript.html and is published with his permission.  

    In order to simulate a calibrated printer it is possible to first print a job into a file and then edit a calibration block into the ps-file before sending the file to a printer. 

    First the document to be printed is printed into a file, this creates the PostScript file. Then the calibration data with the settransfer command has to be inserted into that ps-file. The calibration block is as follows: 

----------start of calibration block---------- 
/lut [  
%The first value is for the level 0 (black)  
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15   %levels 0 ... 15  
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32   %levels 16 ... 31  
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47   %levels 32 ... 47  
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63   %levels 48 ... 63  
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79   %levels 64 ... 79  
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95   %levels 80 ... 95  
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111   %levels 96 ... 111  
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 %levels 112 ... 127  
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 %levels 128 ... 143  
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 %levels 144 ... 159  
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 %levels 160 ... 175  
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 %levels 176 ... 191  
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 %levels 192 ... 207  
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 %levels 208 ... 223  
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 %levels 224 ... 239  
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 %levels 240 ... 255  
%The last value is for level 255 (white).  
] def  
{255 mul 0.5 add cvi lut exch get 255 div} settransfer  
----------end of calibration block---------- 

In the above calibration block the calibration data is a dummy one,  it does not change the behavior of the printer at all, it is there for clarity. 

The actual transfer curve of the printer need to be measured so that the calibration data can be created (and the dummy data is replaced). It does not matter how many rows there are between the"[" and "]" but the 256 values must be in order from black to white and the scale is from 0 to 255. The "%" denoted a comment in PostScript. 

In order to measure the transfer curve of your printer you can buy a densitometer. Or use my calibration method, it is free. 

The next question is exactly where to insert the calibration block within the ps-file.  This possibly varies from application to application that are used for printing. In case of Word97 (and jpg images) the image data appears directly below rows that has the "doNimage" alone on it. If the calibration block is inserted just above the "doNimage" row then that image prints calibrated. The problem here is that the calibration block needs to be inserted for each image. Again in a ps-file created by Word97 if the above calibration block is inserted just below the last row that has "%end resource" alone on that row then the calibration is in effect for the whole document. 

Finally the ps-file is sent to printer. In Windows an utility like GSView can be used for this or a command: copy /b printjob.ps printer_port  in the dos-promt does it easily. printjob.ps is the filename to print and printer_port is the LPT1: for a parallel connected printer or a network que in form of \\servername\printername in case a network printer. 


Accurate Image Manipulation for Desktop Publishing 

Copyright Timo Autiokari, 1997-2007. Contact info