Class Crop

Constructors

Properties

directoryPath: string = ...
searchPattern: string = ...

Methods

  • Crops to a 3:1 ratio and positions the image.

    Parameters

    • filePath: string

      The file path of the HTML file.

    • img: HTMLImageElement

      The image path.

    • position: number

      The vertical position of the crop (0-100%). 0% is the top of the image, 100% is the bottom.

    Returns void

    Error - The file path does not exist

    TypeError - The supplied image is null.

    TypeError - The position value is not a number.

    RangeError - The position value is outside the range 0-100.

    RangeError - The image has no 'src' or 'alt' attribute(s).

  • Analyse the HTML file and crop images.

    Parameters

    • filePath: string

      The file path of the HTML file.

    Returns void

    Error - The file path does not exist.

    Error - No content found in file.

    Error - Failed to create DOM from content.