Faramir PSP Support functions

released 2005.06.20

function : FaramirStairwayInterpolation

  • author: Fabrice Roux aka Faramir.fr
  • purpose: rescales the current image in multiple steps in order to preserve image quality and prevent aliasing
  • returns: -
  • parameters:
    Environment - PSP environment :)
    nOrigX - original image width
    nOrigY - original image height
    nDestX - destination image width
    nDestY - destination image height
    nSteps - number of steps from original to destination
  • notes: -

function : FaramirSupportCheck

  • author: Fabrice Roux aka Faramir.fr
  • purpose: Checks the current Faramir support function pack version. This will allow to detect support script pack version mismatch.
  • returns: -
  • parameters:
    Environment - PSP environment :)
    nRequiredVersion - the minimum required version of the support pack
    nIdealVersion - the ideal version required to have the best results
  • notes: -

function : FaramirPSPVersionCheck

  • author: Fabrice Roux aka Faramir.fr
  • purpose: Checks the current Paint Shop Pro version. This will allow to detect major version mismatch.
  • returns: -
  • parameters:
    Environment - PSP environment :)
    nRequiredVersion - the minimum required version of PSP
    nIdealVersion - the ideal version required to have the best results
  • notes: -

function : FaramirExifAutoRotate

  • author: Fabrice Roux aka Faramir.fr
  • purpose: Automatically rotate the current image according to EXIF orientation. It requires a camera with an orientation sensor + all EXIF information.
  • returns: rotation applied to the image
  • parameters:
    Environment - PSP environment :)
  • notes: -

function : FaramirSplit

  • author: Fabrice Roux aka Faramir.fr
  • purpose: Splits the current image into n images according to the aspect ratio.
  • returns: -
  • parameters:
    Environment - PSP environment :)
    nSplitX - number of horizontal chunks
    nSplitY - number of vertical chunks
    dAspectRatio - aspect ratio of the target images
    bSaveEnable - automatic image save (--> image_00_01.jpg)
    bFileClose - automatically close the saved image to save some RAM
  • notes: The SelectAll + Crop is required to workaround a PSP bug.

function : FaramirProRata

  • author: Fabrice Roux aka Faramir.fr
  • purpose: computes a proportional value included in [nMinValue, nMaxValue]
  • returns: the computed value
  • parameters:
    nMeasure - the measure (width, height,...)
    lParams contains:
    ValMin - the lower limit of the value
    ValMax - the higher limit of the value
    MesMin - the measure that gives the min value
    MesMax - the measure that gives the max value
  • notes: -

function : FaramirEXIFtoString

  • author: Fabrice Roux aka Faramir.fr
  • purpose: replaces the EXIF directive by their respective value in order to build a variable signature string. 'Photographer (c) $EXIFYear' --> 'Photographer (c) 2005'
  • returns: the string with EXIF fields
  • parameters:
    Environment - PSP environment :)
    szControlString - the string with EXIF directives
  • notes: Current date and time is used if EXIF field is empty

function : FaramirStringDefault

  • author: Fabrice Roux aka Faramir.fr
  • purpose: returns a default value if the parameter string is empty
  • returns: the parameter string or the default string
  • parameters:
    szParameter - the string that controls everything
    szDefault - the default string value
  • notes: Current date and time is used if EXIF field is empty

function : FaramirPanoramaRotate

  • author: Fabrice Roux aka Faramir.fr
  • purpose: rotates a 360° panoramic image
  • returns: -
  • parameters:
    Environment - PSP environment :)
    nPixelOffset - offset to apply to the panoramic image
    bVerticalRotation - option to rotate a vertical panorama
  • notes: -

function : FaramirPosition

  • author: Fabrice Roux aka Faramir.fr
  • purpose: calculates the points required for croping or adding text.
  • returns: dictionary containing 2 crop points, 1 text point and 1 text alignment
  • parameters:
    Environment - PSP environment :)
    nPosition - one of the 9 possible pre defined positions (0-8)
    nMarginX - horizontal margin of the current image
    nMarginY - vertical margin of the current image
    nSizeX - target crop horizontal size
    nSizeY - target crop vertical size
    nTextOffset - offset to compensate the text size
  • notes: -

function : FaramirStacker

  • author: Fabrice Roux aka Faramir.fr
  • purpose: stacks all the opened images in either sum or average mode.
  • returns: -
  • parameters:
    Environment - PSP environment :)
    bAverageMode - flag to activate the averaging stacking mode (denoiser)
  • notes: -

function : FaramirExtractNumber

  • author: Fabrice Roux aka Faramir.fr
  • purpose: extract the numeric value out of an EXIF string.
  • returns: the numeric value or 0 if unable
  • parameters:
    szString - string containing the value. (ie: 'F/5.6 (343)' -> 5.6
  • notes: -