home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / graphics / sprtools_1 / docs / spr_fsi < prev    next >
Encoding:
Text File  |  1999-01-15  |  14.2 KB  |  357 lines

  1. spr_fsi
  2. =======
  3.  
  4. Version 1.20 (10-Jan-1998)
  5. SPRtools block 1e release.
  6. (C) 1993-4 DEEJ Technology PLC
  7.  
  8. Features
  9. --------
  10. Sprite processing tools, features provided;
  11.  
  12.         Increase / Decrease bits per pixel (number of colours),
  13.         Floyd Steinburg Integer dithering,
  14.         Image scaling with true sub-sampling (anti-aliasing) and interpolation,
  15.         Image cropping
  16.         Dynamic intensity range expansion,
  17.         Gamma correction,
  18.         Image inversion,
  19.         Filters including smoothing, sharpening, noise removal & user defined
  20.         Support for common fixed palettes,
  21.         Palette optimisation,
  22.  
  23. Restrictions
  24. ------------
  25. Enough memory must be available to hold the source image and two lines of
  26. the destination image. Further memory is required by certain operations
  27. such as filtering. Palette optimisation can require a large amount of memory
  28. for images with thousands of colours.
  29.  
  30. Only the first sprite in the file is recognised.
  31.  
  32. Syntax
  33. ------
  34. spr_fsi [-bpp <bpp>]
  35.     [-scale <scale>]
  36.     [-crop <crop>]
  37.     [-palette <palette>]
  38.     [-invert]    
  39.     [-expand]
  40.     [-gamma <gamma>]
  41.     [-filter <filter>]
  42.     [-aspect]
  43.     [-nodither]
  44.     [-nointerp]
  45.     [-quiet]
  46.     [-help]
  47.     [-in <input sprite file>]
  48.     [-out <output sprite file>]
  49.     [-err <progress/error file>]
  50.  
  51. Options may be abrieviated to the minimum unique form.
  52. All options and parameters are case specific.
  53.  
  54. Files default to stdin and stdout with progress or errors to stderr.
  55.  
  56. -bpp <bpp>
  57. <bpp>    = {1 | 2 | 4 | 8 | 15 | 24 }
  58.  
  59.         Bits per pixels in the output image. The default is 24.
  60.         The 24 bpp option produces the standard 24/32 bit deep sprite
  61.         format, a (non-standard) true 24 format is also available,
  62.         which is described later.
  63.  
  64. -scale <scale>
  65. <scale> = {<xsize> ,<Ysize> |
  66.        <XYmul>:<XYdiv>  | 
  67.        <Xmul>:<Xdiv>,<Ymul>:<Ydiv> }
  68.  
  69.         The amount the scale the output image can be specified in
  70.         three ways.
  71.  
  72.         <Xsize>,<Ysize> scales to an absolute size
  73.         e.g. -scale 1280,1024 for a sprite 1280x1024 pixels
  74.  
  75.         <XYmul>:<XYdiv> scales both axis by the same ratio
  76.         e.g. -scale 3:2 to expand by 3/2 (1.5)
  77.  
  78.         <Xmul>:<Xdiv>,<Ymul>:<Ydiv> scales each axis separately
  79.         e.g. -scale 3:2,1:2 to expand horizontally by 3/2
  80.                                 and reduce vertically by 1/2
  81.  
  82.         Scales which would produce a very small output sprite, or
  83.         equate to an expansion of more than 128x in any direction are 
  84.         prevented. The scale defaults to 1:1 in each direction, unless
  85.         the input image has rectangular pixels and the -aspect flag is
  86.         not set, in this case a scale of 1:1,2:1 is used to covert the
  87.         sprite to use square pixels.
  88.     
  89. -crop <crop>
  90. <Crop> = <left>,<top>,{<right>  | <+Xsize> | <-right>},
  91.                       {<bottom> | <+Ysize> | <-bottom>}
  92.                       
  93.                  Crops the source image to the desired size.
  94.  
  95.                  For a source image of 160x128, to crop 5 pixels from
  96.                  each edge the following could be used.
  97.                                   
  98.                  e.g. -crop 5,5,-5,-5
  99.                  or   -crop 5,5,145,123
  100.                  or   -crop 5,5,+150,+118
  101.  
  102. -palette <palette>
  103. <palette> = {rgb | grey | desktop | win3 | fix | opt }
  104.  
  105.         Selects the palette type for output sprites with 1-8 bpp.
  106.         The palette defaults to the same as the input sprite.
  107.         If the input sprite does not have a palette, the default for
  108.         a RISC OS mode with the same bpp is used. Certain palette
  109.         types may only be used for some numbers of bits per pixel in
  110.         the output sprite.
  111.  
  112.         The ‘rgb’ palette can be used with bpp 4 and 8. In 4 bpp the
  113.         palette gives 9 grey levels, 6 fully saturated colours and
  114.         orange, in a layout designed to be desktop friendly. In 8 bpp
  115.         the palette gives 46 grey levels plus a 6x6x6 level RGB colour
  116.         cube (combinations of 6 levels for each component).
  117.  
  118.         The ‘grey’ palette gives linear grey scales for bpp 1-8,
  119.         giving 2 to 256 grey levels.
  120.         
  121.         The ‘desktop’ palette gives the standard 16 colour RISC OS
  122.         desktop palette in 4 bpp, and the standard VIDC1 256 colour
  123.         mode palette in 8 bpp. 
  124.  
  125.         The ‘win3’ palette gives a Windows 3 palette in 4 bpp,
  126.         consisting of 4 grey levels, 6 fully saturated colours and 
  127.         6 half brightness colours. In 8 bpp a custom (non-Windows) 
  128.         palette with 176 grey levels, a 4x4x4 level colour cube plus 
  129.         18 RGYBMC shades is used.
  130.  
  131.         The ‘fix’ palette will use the input sprites palette (or the
  132.         default) but will convert old type 12 bit palettes stored in
  133.         the sprite to full 24 bit. e.g. &B0G0R0xx to &BBGGRRxx
  134.  
  135.         The ‘opt’ palette will examine the input sprite after all
  136.         pre-processing operations have been performed, and will choose
  137.         the best combination of colours to use in the output image.
  138.         More details on this process are given below. This option
  139.         can only be used for output sprites of 4 or 8 bpp.
  140.  
  141. -invert        Invert the source image before processing.
  142.  
  143. -expand        Expand the dynamic range the source image before processing.
  144.         Expand works by finding the lowest and highest intensity pixels
  145.         in the image, the colours of all pixels in the image are then
  146.         adjusted so that the intensities range from zero to maximum.
  147.  
  148. -gamma <gamma>
  149. <gamma>    = positive floating point number
  150.  
  151.         Gamma correction can be performed on the source image before
  152.         processing. The default value is 1.0 which has no effect.
  153.         Values >1.0 (2.2 is the recognised standard) are used to move
  154.         the contrast detail in the image to the brighter part of the
  155.         intensity range. This use useful for correcting scanned images
  156.         and for preparing sprites for printing. Values less than 1.0
  157.         can be used to move detail to darker intensities.
  158.  
  159. -filter <filter>
  160. <filter> = {filter> | <user filter> }
  161.  
  162.         Filters can be used to perform a variety of image processing
  163.         on the image before further processing. See later for a
  164.         description of how filtering works.
  165.  
  166. <standard filter> = filter name:-
  167.         sharpen1 - Sharpen week
  168.         sharpen2 - Sharpen medium
  169.         sharpen3 - Sharpen strong
  170.         smooth1  - Smooth week
  171.         smooth2  - Smooth medium
  172.         smooth3  - Smooth strong
  173.         average  - Averages with surrounding pixels
  174.         noise1   - Noise removal week
  175.         noise2   - Noise removal medium
  176.         noise3   - Noise removal strong
  177.         edge     - Horizontal and vertical edge extraction
  178.         edgeV    - Vertical edge extraction
  179.         edgeH    - Horizontal edge extraction
  180.         edgeNW   - Edge extraction along a 45 degree angle
  181.         edgeNE   - Edge extraction along a 45 degree angle
  182.         edgeSW   - Edge extraction along a 45 degree angle
  183.         edgeSE   - Edge extraction along a 45 degree angle
  184.         emboss1  - 3D embossing effect
  185.         emboss2  - 3D embossing effect, inverted
  186.  
  187. <user filter> = <a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,[<mul>,[<div>,[<add>,[<diff>]]]]
  188.         Where <a> to <h> are the rows and columns of the 3x3 filter
  189.         matrix. <mul> and <div> are the summation scaling factors which
  190.         default to 1. <add> is an optional component to be added after
  191.         scaling. <diff> is the optional noise filtering level.
  192.         All numbers are positive or negative integers except <div> and
  193.         <diff> which must be positive.
  194.         
  195. -aspect        Normally all sprites containing rectangular pixels are 
  196. converted
  197.         to square pixels during processing (doubling the Y resolution),
  198.         if the -aspect flag is given a rectangular pixel input sprite
  199.         will give a rectangular pixel output sprite.
  200.  
  201. -nodither    This option can be used to prevent Floyd Steinburg Integer
  202.         dithering from being used during processing. This will speed
  203.         up processing but will result in a poor quality output. It
  204.         has no effect when the output sprite is 24 bpp.
  205.  
  206. -nointerp    This option prevents pixel area summing or interpolation being
  207.         used when scaling the image (see the section below on scaling).
  208.         This will speed up the scaling of images, but with a reduction
  209.         in quality. It can be used when scaling up an image to prevent
  210.         the loss of sharpness caused by interpolation.
  211.  
  212. -quiet        Prevents the printing of the state of options on stderr during
  213.         processing.  Progress and errors are still output.
  214.  
  215. -help        Prints a syntax summary.
  216.  
  217.  
  218. Info
  219. ----
  220. True 24 bit sprite format:
  221.         spr_fsi normally produces standard RISC OS deep sprite 24/32
  222.         bpp format when using -bpp 24, this format is 25% larger than
  223.         other 24 bit formats and does not compress as well.
  224.  
  225.         By using ‘-bpp 8 -palette rgb’ a non standard true 24 bit deep
  226.         sprite can be produced. It will not be understood by RISC OS
  227.         applications, but can be used as a storage format for sprites
  228.         to be used again with spr_fsi.
  229.  
  230.         The format has a sprite mode specifier of type 8 (currently
  231.         unassigned in RISC OS 3.5) and stores pixels as consecutive
  232.         three byte quantities (blue, green and red bytes) padded to
  233.         the next word boundary at the end of each line.
  234.  
  235. Scaling        spr_fsi uses two techniques to improve the scaling of images.
  236.         The first is used when scaling down an image, where each output
  237.         pixel will depend on many pixels in the input. An area of the
  238.         source image corresponding to a pixel in the destination image
  239.         is summed to give an average colour. This achieves the effect
  240.         of anti-aliasing which reduces loss of detail due to scaling
  241.         down.
  242.  
  243.         When scaling up a pixel in the input is converted to many 
  244.         pixels in the output. To prevent a blocky image pixels are 
  245.         interpolated to achieve a smooth graduation between them,
  246.         rather than sharp boundary. This produces a much smoother
  247.         image at the expense of some sharpness (the image can be
  248.         pre-sharpend first using a filter).
  249.  
  250.         If the image is being scaled up in one direction and reduced
  251.         in another the two techniques are used together. Anti-aliasing
  252.         and interpolation may be turned off using -nointerp.
  253.  
  254. Optimised palette
  255.         When reducing the number of bits per pixel of an image the
  256.         various fixed palette types can be chosen to represent colours
  257.         which will be close to the original. Most fixed palettes aim
  258.         to cover the colour cube by providing shades which have
  259.         combinations red, green and blue ranging from zero to maximum.
  260.  
  261.         These fixed palettes work well for images which have a large
  262.         range of colours spanning the colour cube, but where an image
  263.         has for example, a large number of green shades, a few reds
  264.         and no blues, many colours in the fixed palette will not be
  265.         used, and the green shades will be reduced to a far few
  266.         number in the output. In this case a palette with more green
  267.         shades and no blue would be more appropriate.
  268.  
  269.         When reducing images down to 8 (or 4) bpp the -palette opt
  270.         option will cause the input sprite to be analysed and the
  271.         256 (or 16) colours which will give the best possible match
  272.         to the original image chosen, and used in the output images
  273.         palette.
  274.  
  275.         After any pre-processing operations have been performed, a
  276.         histogram of all the colours used in the input image is
  277.         built. The histogram is then filtered to remove colours which
  278.         are only used a few times to reduce the amount of calculation.
  279.         The remaining colours are picked out so as to reduce the
  280.         difference between the source and destination images as much
  281.         as possible. This is calculated by the amount of use of the
  282.         colour and how close similar colours are to it.
  283.  
  284.         Usually the optimised palette will generate an image which
  285.         is much closer to the original, with dithering greatly reduced.
  286.         For some images however, the results may not be as pleasing
  287.         as one of the fixed palettes. Experimentation may be necessary.
  288.  
  289. Filters        Filters work by taking a pixel and modifying its value
  290.         depending on the 8 surrounding pixels. The filter consists of
  291.         a 3 by 3 matrix, the center corresponding to the current pixel.
  292.         The values in the matrix are used to multiply the value of the
  293.         pixel under it, values may be positive or negative
  294.  
  295.         e.g. 1 2 1    The center pixel is multiplied by 4, its 
  296.              2 4 2    neighbours horizontally an vertically are
  297.              1 2 1    multiplied by 2, and its diagonals by 1.
  298.  
  299.         The sum of the nine pixels multiplied by the matrix elements
  300.         is multiplied and divided by scaling factors to reduce its
  301.         range back to the valid values for a pixel. In the above
  302.         example the sum comes to 16x, so it must be divided by 16.
  303.  
  304.         Another value may be added to the sum to brighten the pixel
  305.         (+ve) or darken it (-ve).
  306.  
  307.         Finally a differencing filter value can be given. If the
  308.         difference between the original pixel and the result of the
  309.         above process is greater than the difference value the pixel
  310.         is unchanged, other wise it is replaced with the filtered
  311.         value. If no difference is given the pixel is always replaced.
  312.  
  313.         Filters work on each colour component separately and can
  314.         produce colour changes, e.g. the edge extracting filter.
  315.         Filters work on the input image and can only use the closest
  316.         colours in the input image to represent the desired filter
  317.         values. It is recommended that filter is done with as many
  318.         bits per pixel as possible. e.g. if an 8 bpp image is going
  319.         to be filtered to and increased to 24bpp, the increase depth
  320.         is done first, followed by another run to do the filtering.
  321.  
  322. Processing      The main processing done by spr_fsi is the scaling and the
  323.         change in colour depth which are done at the same time.
  324.         Other pre-processing options are performed before this
  325.         in the following order.
  326.  
  327.         filter            (modifies input image in memory)
  328.         invert            (modifies palette only if image <= 8bpp)
  329.         expand            (modifies palette only if image <= 8bpp)
  330.         gamma            (modifies palette only if image <= 8bpp)
  331.         optimise palette    (only effects output image)
  332.  
  333.         Certain operations such as filtering should be done with the
  334.         maximum bpp, and others may give better results if done after
  335.         scaling. Two (or more) runs of spr_fsi can be performed to
  336.         achieve the best results.
  337.         
  338. Deinterlacing   To remove interlace artifacts from digitised images (casued by
  339.                 the odd an even fields of a video frame differing when there
  340.                 has been movement, giving jagged edges of objects on alternate
  341.                 lines), the following processing options can be used:-
  342.                 
  343.                 Scale to half vertical height using no interpolation
  344.                 (just remove every other line)
  345.                 spr_fsi -scale 1:1,1:2 -nointerp -in <infile> -out <outfile>               
  346.                 Scale back up to full height
  347.                 spr_fsi -scale 1:1,2:1 -in <infile> -out <outfile>
  348.                 
  349.                 Apply slight vertical sharpening (the 5 can be alterned
  350.                 to increase or decrease the effect)
  351.                 spr_fsi -filter 0,-1,0,0,5,0,0,-1,0 -in <infile> -out <outfile>
  352.  
  353.  
  354. See also spr_info.
  355.  
  356. !ComndCTRL configuration file: spr_fsi
  357.