Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > acadadda35bd4359b26addbcbc43ba15 > files > 4

ppmtocpva-1.0-14.x86_64.rpm

This program converts PPM files to the format used by the Citizen
Printiva series printers -- and therefore also, I presume, the Alps
MD series, at least in the earlier versions.
I don't have an Alps printer, so I can make no guarantees about what works. 
The Printiva 600C corresponds to a very early Alps model; there may be
changes in later models that break things.
In particular, I would be interested to know whether the output from
this program works with the Alps MD-5000 (sold in Europe as the Oki
DP-5000).
(It appears that Alps have now (2001) sold their printer business to
OKI.)


This program is NOT written for robust end-user use! It is merely the
result of many weeks' experimentation; it includes numerous
experimental features that turned out to be useless, and the options
are designed to give maximum control, not maximum ease of use.

I would like to acknowledge with gratitude the help of Citizen, who
provided me with the programmers' guide for the Printer Control
Language (which they call RGL, for Raster Graphics Language).



INTRODUCTION.

The Citizen/Alps (Citizen denied to me that they were just OEMing
Alps' printers, but that's what it looked like to me. The RGL
spec was a Citizen internal document, but if one opens up a Printiva,
one finds a circuit board labelled "ALPS"!) printers are thermal transfer
printers. The ink is a solid resin carried on a plastic tape, which is
melted onto the paper by the printhead applying heat to the back of
the tape.
The distinctive feature of these printers is that the output is
waterproof and lightfast: there is no discernible fading after years
in normal lighting conditions. I haven't tried leaving output in direct 
sunlight, but I understand that the colour is pretty fast against even 
that.
The major disadvantage is that some useful colours are
unobtainable. In particular, it is impossible to obtain a dark rich
blue: the cyan/magenta mix is quite dull, compared to the brilliant
blue given by inkjet printers. More generally, fine colour balancing
is very difficult; because of the thermal transfer process, two
adjacent dots lay down much more ink than two separated dots, and
because of the solid ink, mixing of colours behaves differently from
inkjets. The primary colours are also perhaps not ideal: the magenta
seems to be too blue, and the cyan too green. 
The colour balancing in this program is mostly empirical.

Halftoning is also a problem. Again because of the thermal transfer
process, one cannot assume that there's a linear relation between the
number of "on" dots in a cell and the perceived darkness. Moreover,
there are very noticeable Moire effects with most screen angles.
It should be said that Ghostscript's default halftone is OK, but at
600dpi it uses quite a low resolution screen, and one can get a finer
halftone. The halftone built into this program is twice the screen
resolution of Ghostscript's, and uses non-standard screen angles and
horrible hacks that after much experimentation were found to minimize
Moire effects. 


There is also another halftoning algorithm included, which exploits a
little-used feature of the printer. The standard Windows drivers print 
a page in four passes, CMYK. Of course, this is a cheap home/office
printer, and does not have a highly sophisticated paper feed
mechanism: the fourth pass may be more than 1mm out of registration
with the first.
However, the printer has a mode in which only one pass is made, and
each band is printed CMYK. This is very slow, since the ink cartridge
has to be changed four times for every band, and an A4 page has around 
27 bands, but it does mean that it is possible to lay down the
different inks with almost the same precision that inkjets achieve.
The other halftoning algorithm exploits this by using a rectangular
cell in which the different inks are laid down starting from different 
corners. The effect of this is that fine detail looks better (I
think); the visual effect is also different from that of standard
halftoning.

Program usage:  ppmtocpva [OPTIONS] [PPMFILE]

Input defaults to standard input; output is sent to standard output.

I'll now describe in detail the program options and the printer
features they control.

USEFUL OR POSSIBLY USEFUL OPTIONS:

-black
  The input file is assumed to be greyscale, and will be printed with
  the black cartridge only. If no dithering or halftoning is
  specified, greys will be snapped to the nearer of black or white.
  (If a non-grey file is used, it so happens that only the cyan
  component will be used.)

-curlcorrection
  The printer includes a "curl correction feature". The hot
  printhead causes the paper to curl. To compensate for this,
  there is an extra curl correction head which, on the final pass,
  physically curls the paper the other way. The  -curlcorrection  
  option forces this correction to be applied even if this is not the
  final pass. This can sometimes reduce registration errors, but is
  presumably not normally a good idea, since otherwise it would be the 
  default.

-fine
  Selects "fine" mode, in which the printhead makes two passes so that
  every dot is laid down twice. Useful with rough paper, or to produce 
  very solid colours. Also, of course, uses twice as much ribbon.

-firstplane
  This option means that the program is being used several times for
  multipass printing, and that this is the first pass. See examples
  below. By default, a cyan pass is assumed to be the first, a
  black pass to be the last, and magenta and yellow to be middle
  passes, but if you wish to print in an order other than CMYK, the
  -firstplane,  -midplane  and  -lastplane  options must be used to
  tell the program which pass it is generating. 

-fsdither
  Selects Floyd-Steinberg dithering. On the whole, this printer
  doesn't seem very well suited to dispersed dot dithering, and
  I would recommend using the -halftone option. But this is
  here so it can be tried out. You may need to fiddle with the gamma
  correction.

-fullblack
  Disables normal colour correction, and just applies full black
  generation: i.e. K = 1 - (min(R,G,B) ; C = 1 - R - K; M = 1 - G - K;
  Y = 1 - B - K.

-greyfile PGMFILE
  This option allows explicit control of CMYK printing: the CMY
  components will be taken from the normal input PPM file, and the K
  component will be taken from the given PGM file.

-halftone
  Selects an adapted standard halftoning algorithm.
  Recommended for most applications.
  N.B. If none of  -halftone,  -squaredither or  -fsdither  is given,
  then colours will just be snapped to the nearest primary.

-highres
  The basic resolution of the Printiva and the early Alps models 
  is 600dpi. However, they have the ability to print with double
  the horizontal resolution, i.e. at 1200x600 dpi. This is documented
  and supported only for black printing; it so happens that it also
  works with multipass CMYK printing. If the  -highres  option is
  used, the halftoning algorithms will be adapted to try to use the
  higher resolution. Generally, it is recommended to use  -highres
  only in the documented mode, for printing black text, but under some 
  circumstances superior results can be obtained with highres
  halftoning and CMYK printing. However, this is highly experimental;
  you will probably need to fiddle with the program to get good results.
  Note that the input file is still taken as 600x600dpi, unless
  the  -highresinput  option is given.
  -highres does NOT work with single pass CMYK printing.
  Note also that the top band or so tends not to be correctly printed
  when printing colours in highres.
  I suggest leaving a clear half inch at the top of the page if using
  highres colour.

-highresinput
  This option is only used in conjunction with -highres; it means
  that the input raster data is already 1200x600 dpi, rather
  than 600x600.

-initgamma G
  where G is a floating point number.
  The first phase of colour correction is a gamma correction.
  The gamma factor can be specified by this option.
  The default value is 1.6 with standard halftoning or Floyd-Steinberg 
  (or 1.8 if -highres ), or 1.2 otherwise (i.e. when using the
  -squaredither option).
  (Note that this gamma correction does not mean what it normally
   does. In fact, it converts to HSV space, applies gamma correction
   to the V component, and applies a modified gamma correction to
   the S component. This is just what seems to work...)

-lastplane
  see  -firstplane

-lfadj N
  where N is an integer from -128 to +127.
  This option specifies the line feed adjustment, changing the amount
  by which the printhead advances between passes. If thin white
  stripes appear between bands, a negative lfadj can be used to remove 
  them. Particularly useful with very heavy paper or very light paper; 
  the neutral setting seems correct for normal paper on my printer,
  but reports vary.
  N is in units of 1/9th of a (600dpi) pixel.

-lowres
  Sets the resolution to 300dpi instead of the normal 600dpi.

-media  MEDIATYPE
  Sets the media type. It is unclear what effect this has; the RGL
  manual suggests that the printer may fine-tune the printhead
  behaviour according to the media type. I have seen no observable
  evidence of this, but maybe I don't look closely enough.
  Several media types are available, but not all are supported. It
  appears from the manual that it was originally intended to produce
  special ribbons for overhead transparencies and for label printing.
  However, these have never appeared on the market, from either
  Citizen or Alps.
  The following media types are accepted by this option; the default
  is  paper.
  paper       Normal paper.
  cold        Something described as "cold OHP print media". This
              requires the non-existent special ribbons for OHP, and is
              therefore NOT AVAILABLE.
  iron-on     For printing iron-on transfers. The print will be mirrored.
              It is unclear whether this differs in any way from
              "backprint".
  label       Apparently for label printing. Requires special ribbons,
              which don't exist, so is NOT AVAILABLE.
  thick       Thick paper. Possibly this changes the line feed
              adjustment.
  postcard    Not clear what, if anything, this does.
  highgrade   High grade paper. Again, the effect is unknown.
  ohp         So-called "hot OHP media". This uses the normal ribbons.
              Whether it does anything different from plain paper,
              I don't know.
  backprint   Like paper, but with a mirrored image.

-midplane
  See  -firstplane.

-mono
  Usually the input is a PPM file giving three colour components, and
  so in multipass printing the current component is extracted from the 
  RGB colour.
  If  -mono  is given, the input is assumed to be a greyscale file
  giving the current component only: the option is allowed only when
  printing a single colour. White is interpreted as no ink, black as
  full ink.

-noblack
  The black cartridge is not used: the black component is printed
  as CMY.  See also  -black .

-nocolcor
  This option disables all colour correction.

-nocurl
  This option disables curl correction for the current pass.
  See  -curlcorrection.

-noreset
  Disables the normal "exit raster graphics and reset printer" command 
  at the end of printing. Should not normally be required, unless
  multiple files are to be printed on the same page.

-pageC
-pageM
-pageY
-pageK
  Used for multipass printing. Indicates that only the C,M,Y,K
  component is being printed.
  By default, it is assumed that C is the first pass, and K is the
  last pass; if this is not the case, the  -{first,mid,last}plane
  options (q.v.) must be used.
  Multiple -page options may also be given: in this case, the page is
  printed in single-pass mode, but only the specified colour
  components are printed.

-pagelength L
-pagewidth W
  Explicitly set the page width or length. W and L are dimensions
  given as for -xshift (q.v.).

-papersize PAPERSIZE
  Sets the paper size. The following values are accepted:
  custom     no defined size: the -pagelength and -pagewidth options
             should be used.
  executive  U.S. executive size: 7.5" x 10.5"
  letter     U.S. letter size: 8.5" x 11.0"
  legal      U.S. legal size: 8.5" x 14.0"
  a4         ISO A4: 210mm x 297mm
  b5         ISO B5: 182mm x 257mm
  postcard   Japanese? postcard size: 100mm x 148mm
  The printer's hardwired default is letter, but ppmtocpva defaults to
  a4.
  As well as setting page length and width, the papersize setting
  determines the minimum distance from the physical left edge of the
  paper to the logical left edge (where printing starts). It is
  6.4mm (150 dots at 600dpi) for letter and legal, 3.4mm (80 dots) for
  other defined sizes, and for custom it is 6.4mm for printers shipped
  to the U.S., 3.4 mm for printers shipped to Europe and Japan.
  (The reason for this is the printing width is only 8" or 203mm,
  so the printable area needs to be centred on the page.)
  This is also a convenient place to document the top and bottom
  unprintable areas: the unprintable area at the top between the start 
  of the physical page and the start of the logical page is 284 dots or
  12mm, and the unprintable area at the bottom is around 355 dots or
  15mm.
  For completeness, the following table is reproduced from the RGL
  manual for the Printiva. Sizes are in 600dpi dots.

           physical physical unprint unprint unprint unprint logical  logical
             page     page    able    able    able    able     page     page
            width    length   left   right     top   bottom   width    length
  letter     5100     6600     150     150     284     354     4800     5962
  legal      5100     8400     150     150     284     361     4800     7755
  executive  4350     6300      80      80     284     353     4190     5663
  a4         4960     7015      80      80     284     356     4800     6375
  b5         4298     6070      80      80     284     352     4138     5434
  postcard   2362     3496      80      80     284     342     2202     2870

  WARNING: from observation, it appears that the set-paper-size 
  printer command does NOT actually set the page width and length.
  Therefore ppmtocpva explicitly sets page length and width according
  to the above table, unless the user -pagelength or -pagewidth options
  are given.

  The manual says that when the media type is set to OHP transparency, 
  12 dots are subtracted from the logical page length. Whether this is 
  actually done by the printer, or whether it is a statement about
  what a driver should do, I don't know.

-phadj N
  where N is an integer from -50 to +50.
  Adjusts the strength of the printhead drive signal, and thus the
  intensity of the image. Paradoxically, a negative value increases
  the drive signal, and a positive value decreases it). Not normally very
  useful, but sometimes a convenient alternative to gamma correction.
  (Also useful for some unsupported inks (see note below).

-solidblack
  When dithering in colour, the colour correction normally maps pure
  black in the input to a mixture of C,M,Y,K at about 50% density
  in the output. This is suitable for photographic reproduction.
  However, if you are printing images with black text in or around
  them, this option will force pure black to be mapped to pure black,
  which will improve the sharpness of the text. (It will also make
  the pure black areas of the images look slightly odd.)

-spotfollows
  This option is used to tell the program that a further printing pass 
  (typically to lay down a spot colour such as gold or silver) will
  follow. The effect is that the page is returned to top of form, no
  reset is done, and default curl correction is disabled.

-spotmode
  With this option, the printer can be used with arbitrary ink
  cartridges rather than CMYK.  Everything proceeds as normal except
  that the C component refers to whatever cartridge is in the leftmost 
  cartridge holder, M to the second, Y to the third, and K to the
  rightmost. Typically used in the page mode with one of the 
  -page[CMY] options.

-squaredither
  This option selects the alternative halftoning algorithm described
  above. It should not normally be used with multi-pass printing, as
  it relies on precise registration.
  NOTE that printing will be very slow with this option, as explained
  above.

-version
 Print version and exit.

-xshift X
-yshift Y
  where X and Y are integers (meaning number of dots) or dimensions
  (a floating point number followed by: pt (points), dp (decipoints),
  in (inches), cm (centimetres), or mm (millimetres)).
  Shifts the image by X, Y on the page.
  NOTE that these options must come after -lowres or -highres options.
  If these offsets are positive, they are implemented directly by the
  printer; if they are negative, ppmtocpva will skip rows or columns
  of the input data in order to effect them.

OBSCURE OPTIONS FOR EXPERIMENTING.

-banding
  This option is only for experimentation.
  The Printiva prints in bands, and this can give noticeable banding
  effects in the printed output. The printer contains algorithms to
  ameliorate this, as follows:
  The height of the printhead is 240 dots; however, the printhead
  advances by only 236 dots between passes, and the dots at top and
  bottom are divided between passes. So when printing a solid colour,
  a single pass of the print head actually prints something like 
  the following pattern:
       x       x       x       x   
      xxx     xxx     xxx     xxx  
     xxxxx   xxxxx   xxxxx   xxxxx 
    xxxxxxx xxxxxxx xxxxxxx xxxxxxx
   [ 232 full rows ]
        xxxxxxx xxxxxxx xxxxxxx xxxxxxx
         xxxxx   xxxxx   xxxxx   xxxxx 
          xxx     xxx     xxx     xxx  
           x       x       x       x   
  The precise division of dots between passes appears to depend on
  many things, such as which dots are actually "on", and which
  printing mode the printer is in.
  This is no way to disable this feature, and in some experimental
  work it gets in the way. So the  -banding  option gets
  round it, by printing with only the middle 232 dots of the
  printhead, and using negative line feed adjustment to avoid gaps.

-coldiag
  Implies -ppmout. The output will be a PPM file with the colour
  correction applied. Note that this is not actually correct, since
  it simply adds the K component to each of the C,M,Y components,
  sometimes resulting in overflow.

-evenrowsonly
  Purely for experimentation: only alternate rows of dots will be
  printed.

-ffonly
  Variation on -noreset: does a form-feed at end of page, but
  nothing else.

-htmx X -hmty Y -htmz Z
  where X, Y, Z are integers.
  Specifies the magenta halftone screen angle by giving a Pythagorean
  triple. It should be the case that Z^2 = X^2 + Y^2; if not, strange
  patterns will be generated. Only used for experimenting with
  different screen angles.

-nopack
  By default, raster data is compressed with TIFF 4.0 packbits
  encoding. This option disables compression. Normally only useful for 
  debugging the compression code.

-oddrowsonly
  Purely experimental: suppresses printing of alternate rows.

-ppmdiag
-ppmout
  Options for debugging the halftoning. Instead of writing out a PCL
  file, the program will write out another PPM file containing the
  raster data that would be sent to the printer.
  If the  -ppmout  option is used, then the binary CMYK values are converted
  naively back to RGB. To allow one to tell exactly which pixels are
  set,  -ppmdiag  can be used: in this case, printed C,M,Y pixels
  are output as light cyan,magenta,yellow, and the presence of K in
  the pixel darkens it, so that, for example, a pixel in which C,M,K
  are printed will appear as dark blue.

-raster
  This option forces single pass CMYK or spot colour printing, in
  which successive bands are printed in all four colours.
  This mode is automatically selected whenever appropriate; this
  option is needed only if it is desired to force printing of a single
  colour component in single-pass mode, by, e.g.,  -pageM -raster .


EXAMPLES.

Assume that /dev/printer is the parallel output to the printer.

Suppose that you have an image at 600x600 dpi as a ppm file
image.ppm .
To print (in the top left of the page) using multi-pass printing,
and the standard halftoning, you do:
  ( ppmtocpva -halftone -pageC image.ppm ;
    ppmtocpva -halftone -pageM image.ppm ;
    ppmtocpva -halftone -pageY image.ppm ;
    ppmtocpva -halftone -pageK image.ppm ) >/dev/printer

To print in a single pass (which will be very slow unless you have the
multi-colour cartridge installed), do
  ppmtocpva -halftone image.ppm >/dev/printer


Now suppose that you have a full colour image in  image.ppm,
and in overlay.ppm you have patterns for gold and silver, with gold
being represented by yellow, silver by cyan, and the background white.
How do you print this?
Option one: first make sure the C M Y K cartridges are installed.
Then proceed as above, but add the   -spotfollows  option to the
command (only to the last command in the multi-pass case).

Then install the silver cartridge in the leftmost holder, and the gold 
cartridge in the third slot. (Note that the paper will still be in the 
printer, at the top of form position.)
Now do:
   ppmtocpva -spotmode -spotfollows -pageC overlay.ppm >/dev/printer
   ppmtocpva -spotmode -pageY overlay.ppm >/dev/printer

This will take six or three passes, depending on whether the full
colour was done multi-pass or single pass. If you have the
multi-colour ink cartridge, the whole process can be done (slowly) in
two passes, without any need to change cartridges mid-way, as follows:
install the gold and silver cartridges as above, and put a black and a 
multi-colour cartridge in the other slots. Then just do:
  ppmtocpva -halftone -spotfollows image.ppm >/dev/printer
  ppmtocpva -spotmode -pageC -pageY overlay.ppm >/dev/printer



Now suppose you have an A4 page of PostScript text in page.ps, and you 
want to print it at with highest resolution possible. You can do this
by:
gs -q -dNOPAUSE -dBATCH -r1200x600 \
 -sDEVICE=ppmraw -sOutputFile=- page.ps \ 
 |  ppmtocpva -highres -highresinput -black \
             -xshift -3.4mm -yshift -12mm >/dev/printer

The -xshift -3.4mm  accounts for the unprintable area at the left
margin (see under the -media option), and the -yshift -12mm for the
unprintable top margin area.

ADDITIONAL FILES INCLUDED

This directory also contains a file cpva-colour, which is a perl
script that can be used as an output filter for ghostscript to
print A4 pages in colour. As in:
gs -q -dNOPAUSE -dBATCH -r600 \
 -sDEVICE=ppmraw -sOutputFile='|cpva-colour %d' severalpages.ps >/dev/printer

The script ignores any arguments; the %d argument just forces GhostScript
to invoke a new instance of the script for each page.

USING UNSUPPORTED RIBBONS

The original Printiva 600 supports the following ribbons:
Cyan, Magenta, Yellow, Black
Metallic Cyan, Metallic Magenta, Metallic Gold.

The Printiva 700 and 1700, and 600s that have been upgraded,
also support
Metallic Silver.

If you have followed the Alps/Oki line, you naturally want to use
the other exciting ribbons. Unfortunately, most of them don't work.
Here is what I know so far about what works.

First, a general note. If you put an unsupported ribbon into the
600, it will not recognize it, and the associated light will not
light on the control panel. However, it will load the cartridge if
told to do so via the -spotmode options. But, there is a catch: it
will only load an unrecognized cartridge as the first cartridge in a
job; if you load a recognized cartridge, it will ignore any attempt to
load an unrecognized cartridge. If you want to make extensive use
of unrecognized cartridges, I suggest that you fake the barcodes on
them to be those of recognized cartridges. However, even here there
is a catch: if two slots hold cartridges with the same barcode, you
are not guaranteed to get the specified cartridge loaded even if you
use -spotmode.

Now, which ribbons work?

Metallic Silver, works fine on an unmodified 600, though not recognized.

Econoblack: This more or less works, provided that the  -phadj -50
option is given. The result is a bit faint, but I don't know how this
compares with the Alps printers. However, it's OK for printing out
drafts, mail messages, etc.

Gold Foil, Silver Foil: Unfortunately, these do not work. If you lay
down a heavy undercoat of (e.g.) black, and then overprint with 
-phadj -50 -highres (which requires faking the cartridge barcode to be
black), you may get partial adhesion, but it is essentially
useless. It might be worth trying the vphoto primer as an undercoat,
but I haven't done this. (I guess that the later Alps models have
a hotter printhead.)

White: this works better, but not perfectly. You probably need
to lay it down twice (with -phadj -50, of course) to get reasonable
results. Curiously, it seems to make a better undercoat for foil than
the usual inks, but it still doesn't make foil work completely.
(Which is just as well, since white is also very expensive.)

Vphoto primer: not tested.

Finish: not tested.

New OKI ribbons: Process C/M/Y/K, spot Red, spot Green.
Not tested. (I would expect these to work; question, how do the
new Process CMYK inks differ from the standard CMYK inks?)