home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 223.lha / IffToPostScript / ifftops.doc < prev    next >
Text File  |  1989-04-07  |  12KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. _i_f_f_t_o_p_s - _t_r_a_n_s_l_a_t_e _a_n _A_m_i_g_a _I_F_F _f_o_r_m_a_t _f_i_l_e _i_n_t_o _P_o_s_t_S_c_r_i_p_t
  8.  
  9. _i_f_f_t_o_p_s[-c]
  10.           [-_p<x-start>,<y-start>,<x-scale>,<y-scale>]
  11.           <_i_n_p_u_t-_f_i_l_e>[<output-file>]
  12.  
  13. _I_f_f_t_o_p_s translates Amiga IFF  format  files  -  specifically
  14. InterLeaved   BitMap   (ILBM)  graphics  IFF  files  -  into
  15. PostScript format.  It handles both black & white images and
  16. color images (see NOTE #1 in NOTES section below), including
  17. HAM mode images.  There are options for positioning an image
  18. on  the  output page, scaling the image (larger or smaller),
  19. rotating the image, and placing multiple images on the  same
  20. output page.
  21.  
  22. The program works by generating a small  PostScript-language
  23. "header"   followed  by  a  hexadecimal  representation  (in
  24. ASCII), of the bits of the image to render, in a raw  format
  25. that  PostScript understands.  When the "header" is executed
  26. by the PostScript interpreter (which is commonly embedded in
  27. the printer being used) it handles the positioning, scaling,
  28. etc. functions and then reads all of the following  data  to
  29. produce the resultant image.
  30.  
  31. All of the command line arguments  are  optional.   The  one
  32. piece  of  information that _i_f_f_t_o_p_s needs is the name of the
  33. input file to process.  If this is not supplied on the  com-
  34. mand line then the user is prompted for it.  (see NOTE #2)
  35.  
  36. The arguments to _i_f_f_t_o_p_s are:
  37.      -c      color. Take a color ILBM IFF file and produce a
  38.           color  PostScript  output  file.  (If this flag is
  39.           used with a black & white ILBM IFF file  then  the
  40.           image  is  rendered  in  black  &  white  with  an
  41.           interesting sepia effect.)
  42.  
  43.      -h      hold page  image.   In  PostScript  terminology
  44.           each  printed  page  is  called  a page image.  By
  45.           default, _i_f_f_t_o_p_s appends a PostScript  command  at
  46.           the  end  of each processed IFF image to cause the
  47.           current page image to print out.  If it is desired
  48.           to  place  more  than  one IFF image onto the same
  49.           printed page (i.e. page image) then this flag will
  50.           cause   the   PostScript   command   (specifically
  51.           "showpage") not to be appended.   (see  "EXAMPLES"
  52.           below)
  53.  
  54.      -s      smooth.  This flag  is  my  own  attempt  (very
  55.           unsophisticated  and brute force) at smoothing out
  56.           the IFF image by doubling the  number  of  pixels,
  57.           both  horizontally  and  vertically, and averaging
  58.           the values.  (see NOTE #3 below)
  59.  
  60.      -r      rotate.  Rotate the image by the  given  number
  61.  
  62.  
  63.  
  64.                        March 21, 1989
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                            - 2 -
  71.  
  72.  
  73.           of  degrees.   The  value  for the degrees must be
  74.           between 360 and -360.  Positive values  result  in
  75.           counterclockwise rotation.
  76.  
  77.      -p      position.  Place and size the IFF image  within
  78.           the  PostScript  page image (i.e. on the resultant
  79.           printed page.) <x-start>  and  <y-start>  are  the
  80.           PostScript  coordinates  of  the  lower  left-hand
  81.           corner of the image to be printed.   The  defaults
  82.           for  these  are 10 and 10 respectively.  <x-scale>
  83.           and <y-scale> are the  PostScript  dimensions,  of
  84.           the  image  to  be  printed, in the x and y direc-
  85.           tions.  The defaults for these  are  550  and  480
  86.           respectively.  (see "EXAMPLES" below)
  87.  
  88. If an <output-file> is not specified  on  the  command  line
  89. then  the  file  "out.ps"  is  used.   If  the specified (or
  90. default) <output-file> already exists  then  the  output  is
  91. appended  to  the end of this file (this is so that the "-h"
  92. flag (described above) will work.) Be careful that  this  is
  93. what you want - it caused me trouble on several occasions by
  94. appending to files when I didn't intend to.
  95.  
  96. _P_r_o_c_e_s_s _t_h_e _I_L_B_M _I_F_F _f_o_r_m_a_t _f_i_l_e _n_a_m_e_d  "_d_o_g"  _a_n_d  _p_u_t  _t_h_e
  97. _r_e_s_u_l_t_i_n_g _P_o_s_t_S_c_r_i_p_t _o_u_t_p_u_t _i_n _t_h_e _f_i_l_e "_d_o_g._p_s":
  98.         _i_f_f_t_o_p_s _d_o_g _d_o_g._p_s
  99.  
  100. _P_o_s_i_t_i_o_n _a_n_d _s_c_a_l_e _t_h_e _i_m_a_g_e _t_o _b_e _i_n _t_h_e _c_e_n_t_e_r _o_f _t_h_e _p_a_g_e
  101. _a_n_d _t_o _b_e _f_o_u_r _i_n_c_h_e_s _b_y _t_h_r_e_e _i_n_c_h_e_s:
  102.         _i_f_f_t_o_p_s -_p _1_6_2,_2_8_8,_2_8_8,_2_1_6 _d_o_g _d_o_g_2._p_s
  103.  
  104. _P_o_s_i_t_i_o_n, _s_c_a_l_e, _a_n_d _r_o_t_a_t_e _t_h_e _i_m_a_g_e _s_o _t_h_a_t _t_h_e_r_e _a_r_e _f_o_u_r
  105. _c_o_p_y_s  _o_f  _t_h_e  _i_m_a_g_e  _o_n  _t_h_e  _p_a_g_e, _s_i_d_e-_b_y-_s_i_d_e, _a_l_l _f_o_u_r
  106. _i_n_c_h_e_s _b_y _t_h_r_e_e _i_n_c_h_e_s:
  107.         _i_f_f_t_o_p_s -_h -_r _9_0 -_p _3_0_6,_3_9_6,_2_8_8,_2_1_6 _d_o_g _d_o_g_3._p_s
  108.         _i_f_f_t_o_p_s -_h -_r _9_0 -_p _5_2_2,_3_9_6,_2_8_8,_2_1_6 _d_o_g _d_o_g_3._p_s
  109.         _i_f_f_t_o_p_s -_h -_r _9_0 -_p _3_0_6,_1_0_8,_2_8_8,_2_1_6 _d_o_g _d_o_g_3._p_s
  110.         _i_f_f_t_o_p_s -_r _9_0 -_p _5_2_2,_1_0_8,_2_8_8,_2_1_6 _d_o_g _d_o_g_3._p_s
  111.  
  112. _1.)     _T_h_e _c_o_l_o_r _P_o_s_t_S_c_r_i_p_t _s_y_n_t_a_x _h_a_s _o_n_l_y _b_e_e_n _t_e_s_t_e_d  _o_n
  113.      _a  _Q_M_S _C_o_l_o_r_s_c_r_i_p_t-_1_0_0 _p_r_i_n_t_e_r.  _S_i_n_c_e _c_o_l_o_r _P_o_s_t_s_c_r_i_p_t
  114.      _p_r_i_n_t_e_r_s _a_r_e _r_a_t_h_e_r _n_e_w, _a_n_d _s_i_n_c_e _t_h_e _P_o_s_t_S_c_r_i_p_t  _s_y_n_-
  115.      _t_a_x  _f_o_r  _h_a_n_d_l_i_n_g _c_o_l_o_r _i_m_a_g_e_s _h_a_s _n_o_t _y_e_t _b_e_e_n _s_t_a_n_d_-
  116.      _a_r_d_i_z_e_d, _t_h_e_r_e _i_s _a _g_o_o_d _c_h_a_n_c_e _t_h_a_t  _t_h_e  _o_u_t_p_u_t  _g_e_n_-
  117.      _e_r_a_t_e_d  _b_y _t_h_i_s _p_r_o_g_r_a_m _w_i_l_l _n_o_t _w_o_r_k _o_n _p_r_i_n_t_e_r_s _b_u_i_l_t
  118.      _b_y  _o_t_h_e_r  _m_a_n_u_f_a_c_t_u_r_e_r_s.   _T_h_e  _s_o_u_r_c_e  _c_o_d_e  _c_o_n_t_a_i_n_s
  119.      _p_r_e_p_r_o_c_e_s_s_o_r  _s_t_a_t_e_m_e_n_t_s  (_i._e.   "#_d_e_f_i_n_e  _Q_M_S") _w_h_i_c_h
  120.      _s_u_r_r_o_u_n_d _t_h_e _c_o_l_o_r _P_o_s_t_S_c_r_i_p_t _s_p_e_c_i_f_i_c _l_i_n_e_s _s_o,  _h_o_p_e_-
  121.      _f_u_l_l_y, _i_t _s_h_o_u_l_d _b_e _s_t_r_a_i_g_h_t-_f_o_r_w_a_r_d _t_o _a_d_d _s_u_p_p_o_r_t _f_o_r
  122.      _o_t_h_e_r _m_a_n_u_f_a_c_t_u_r_e_r_s' _p_r_i_n_t_e_r_s, _i_f _i_t _i_s _n_e_c_e_s_s_a_r_y.
  123.  
  124. _2.)     _A_l_l _o_f _t_h_e _c_o_d_e _d_e_v_e_l_o_p_m_e_n_t  _f_o_r  _t_h_i_s  _p_r_o_g_r_a_m  _w_a_s
  125.      _d_o_n_e  _o_n _a _S_u_n _s_y_s_t_e_m _r_u_n_n_i_n_g _S_u_n_O_S (_i._e. _U_N_I_X) _f_o_r _t_h_e
  126.      _f_a_i_r_l_y _w_e_a_k _r_e_a_s_o_n _t_h_a_t _I _d_i_d _n_o_t _h_a_v_e _a  _c_o_m_p_i_l_e_r  _f_o_r
  127.  
  128.  
  129.  
  130.                        March 21, 1989
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                            - 3 -
  137.  
  138.  
  139.      _m_y  _A_m_i_g_a  _a_t  _t_h_a_t  _t_i_m_e  (_a_l_s_o,  _t_h_e  _o_n_l_y _P_o_s_t_S_c_r_i_p_t
  140.      _p_r_i_n_t_e_r_s _t_h_a_t _I _h_a_d _a_c_c_e_s_s _t_o _w_e_r_e  _a_v_a_i_l_a_b_l_e  _v_i_a  _t_h_e
  141.      _S_u_n.)  _T_h_e_r_e_f_o_r_e,  _I  _h_a_v_e _m_a_d_e _s_u_r_e _t_h_a_t _t_h_e _c_o_d_e _c_o_m_-
  142.      _p_i_l_e_s _u_n_d_e_r _b_o_t_h _U_N_I_X _a_n_d _A_m_i_g_a_D_O_S.   _T_h_e  _s_o_u_r_c_e  _c_o_d_e
  143.      _c_o_n_t_a_i_n_s  _p_r_e_p_r_o_c_e_s_s_o_r _s_t_a_t_e_m_e_n_t_s _t_o _t_o_g_g_l_e _t_h_e _d_i_f_f_e_r_-
  144.      _e_n_c_e_s _b_e_t_w_e_e_n _t_h_e _t_w_o _e_n_v_i_r_o_n_m_e_n_t_s  (_m_o_s_t_l_y  "#_i_n_c_l_u_d_e"
  145.      _f_i_l_e_s  _a_n_d  _s_o_m_e  "#_d_e_f_i_n_e"_s).  _T_o _c_o_m_p_i_l_e _t_h_i_s _p_r_o_g_r_a_m
  146.      _f_o_r _o_n_e _o_f  _t_h_e  _t_w_o  _e_n_v_i_r_o_n_m_e_n_t_s  _e_i_t_h_e_r  _a  "#_d_e_f_i_n_e
  147.      _A_M_I_G_A"  _o_r _a "#_d_e_f_i_n_e _U_N_I_X" _m_u_s_t _e_x_i_s_t _a_t _t_h_e _b_e_g_i_n_n_i_n_g
  148.      _o_f _t_h_e _f_i_l_e.  _B_e  _s_u_r_e  _t_h_a_t  _O_N_L_Y  _O_N_E  _o_f  _t_h_e_s_e  _t_w_o
  149.      "#_d_e_f_i_n_e"_s _i_s _i_n _e_f_f_e_c_t.
  150.  
  151. _3.)     _T_h_e "-_s" _f_l_a_g _h_a_s _v_e_r_y _l_i_t_t_l_e _n_o_t_i_c_e_a_b_l_e _e_f_f_e_c_t _o_n _a
  152.      _3_0_0  _D_P_I _l_a_s_e_r _p_r_i_n_t_e_r.  _I _b_e_l_i_e_v_e _t_h_a_t _t_h_i_s _i_s _b_e_c_a_u_s_e
  153.      _t_h_e _d_e_f_a_u_l_t "_p_r_i_n_t _c_e_l_l" _s_i_z_e _i_s _a_p_p_r_o_x_i_m_a_t_e_l_y _5_0 _c_e_l_l_s
  154.      _p_e_r   _i_n_c_h.   _O_n  _t_h_e  _Q_M_S  _C_o_l_o_r_s_c_r_i_p_t-_1_0_0  _p_r_i_n_t_e_r  _I
  155.      _p_r_e_p_e_n_d_e_d _t_h_e _f_o_l_l_o_w_i_n_g _P_o_s_t_S_c_r_i_p_t _c_o_d_e,  _b_y  _h_a_n_d,  _t_o
  156.      _t_h_e _o_u_t_p_u_t _f_i_l_e _p_r_o_d_u_c_e_d _b_y _i_f_f_t_o_p_s:
  157.            %!
  158.            /sfreq 72 def
  159.            /sproc {dup mul exch dup mul add 1 exch sub} def
  160.            sfreq 60 /sproc load
  161.            sfreq 30 /sproc load
  162.            sfreq 0 /sproc load
  163.            sfreq 0 /sproc load
  164.            setcolorscreen
  165.      (NOTE: this printer is a four-color printer (YMCB))
  166.      (NOTE: the standard PostScript language has a  counter-
  167.      part "setscreen" command for black & white printers.)
  168.      The result of  adding  these  lines  was  a  noticeable
  169.      reduction in the grainyness of the output file.
  170.  
  171.      An unfortunate side effect of this  smoothing  function
  172.      is  an  aprox.   40% increase in the size of the source
  173.      code file.  (I haven't check the relative sizes of  the
  174.      binary  files.) Because of this and because of its mar-
  175.      ginal usefulness, the source code includes preprocessor
  176.      defines,  keyed on the identifier SMOOTH_INCLUDE, which
  177.      allow the smoothing code to be compiled out of the pro-
  178.      gram.     Specifically,    if    the    line   "#define
  179.      SMOOTH_INCLUDE" exists in  the  source  file  then  the
  180.      smoothing code will be included.
  181.  
  182.      Happily, the  smoothing  function  only  adds  a  small
  183.      amount  to  the  total  execution  time of the program.
  184.      However, the user should take note that using the  "-s"
  185.      flag  causes  the  output  file to be four times larger
  186.      that it would be without using this flag.
  187.  
  188. _o_u_t._p_s              _d_e_f_a_u_l_t _o_u_t_p_u_t _f_i_l_e _i_f _n_o_n_e _i_s _s_p_e_c_i_f_i_e_d
  189.  
  190. _T_h_e_r_e _s_h_o_u_l_d _b_e _a _w_a_y _f_o_r _t_h_e <_i_n_p_u_t-_f_i_l_e> _a_n_d <_o_u_t_p_u_t-_f_i_l_e>
  191. _t_o  _b_e  _r_e-_d_i_r_e_c_t_e_d  _f_r_o_m/_t_o  _s_t_a_n_d_a_r_d-_i_n_p_u_t  _a_n_d  _s_t_a_n_d_a_r_d-
  192. _o_u_t_p_u_t.
  193.  
  194.  
  195.  
  196.                        March 21, 1989
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                            - 4 -
  203.  
  204.  
  205. _L_e_R_o_y _F_u_n_d_i_n_g_s_l_a_n_d, _N_o_v_e_m_b_e_r _1_9_8_8
  206. (_d_e_r_i_v_e_d _f_r_o_m _a _p_r_o_g_r_a_m _c_a_l_l_e_d _C_L_A_Z  _w_h_i_c_h  _w_a_s  _c_r_e_a_t_e_d  _b_y
  207. _S_t_e_v_e _L_u_d_t_k_e, _M_a_y _1_9_8_7)
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                        March 21, 1989
  263.  
  264.  
  265.