Documentation

ImageExtractor
in package

Extract sub-images from an image.

Table of Contents

Properties

$inputSource  : LocalInputSource
Local input object used by the ImageExtractor.
$filename  : string
Name of the file.
$pageImages  : array<string|int, mixed>
Array of extracted page images.
$saveFormat  : string
Format to save the image as.

Methods

__construct()  : mixed
extractImage()  : ExtractedImage|null
Extracts a single image from a Position field.
extractImagesFromPage()  : array<string|int, mixed>
Extract multiple images on a given page from a list of fields having position data.
getInputSource()  : LocalInputSource
Getter for the local input source.
getPageCount()  : int
Gets the number of pages in the file.
pdfToImages()  : array<string|int, mixed>
Renders the input PDF's pages as individual images.
extractFromPage()  : array<string|int, mixed>
Extracts images from a page.
extractImageFromBbox()  : Imagick
Extracts an image from a set of coordinates.
splitNameStrict()  : array<string|int, mixed>
Splits the filename into name and extension.

Properties

$pageImages

Array of extracted page images.

private array<string|int, mixed> $pageImages = []

$saveFormat

Format to save the image as.

private string $saveFormat

Methods

extractImage()

Extracts a single image from a Position field.

public extractImage(BaseField $field, int $pageIndex, int $index, string $filename) : ExtractedImage|null
Parameters
$field : BaseField

The field to extract.

$pageIndex : int

The page index to extract, begins at 0.

$index : int

The index to use for naming the extracted image.

$filename : string

The output filename.

Tags
throws
MindeeGeometryException

Throws if a field does not contain positional data.

Return values
ExtractedImage|null

The extracted image, or null if the field does not have valid position data.

extractImagesFromPage()

Extract multiple images on a given page from a list of fields having position data.

public extractImagesFromPage(array<string|int, mixed> $fields, int $pageIndex[, string|null $outputName = null ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

List of Fields to extract.

$pageIndex : int

The page index to extract, begins at 0.

$outputName : string|null = null

The base output filename, must have an image extension.

Return values
array<string|int, mixed>

A list of extracted images.

getPageCount()

Gets the number of pages in the file.

public getPageCount() : int
Return values
int

pdfToImages()

Renders the input PDF's pages as individual images.

public static pdfToImages(string $fileBytes) : array<string|int, mixed>
Parameters
$fileBytes : string

Input pdf.

Tags
throws
MindeeImageException

Throws if the image can't be handled.

Return values
array<string|int, mixed>

A list of pages.

extractFromPage()

Extracts images from a page.

private extractFromPage(array<string|int, mixed> $fields, int $pageIndex, string $outputName) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

List of Fields to extract.

$pageIndex : int

The page index to extract, begins at 0.

$outputName : string

Name of the created file.

Return values
array<string|int, mixed>

An array of created images.

extractImageFromBbox()

Extracts an image from a set of coordinates.

private extractImageFromBbox(BBox $bbox, int $pageIndex) : Imagick
Parameters
$bbox : BBox

BBox coordinates.

$pageIndex : int

The page index to extract, begins at 0.

Return values
Imagick

splitNameStrict()

Splits the filename into name and extension.

private splitNameStrict(string $filename) : array<string|int, mixed>
Parameters
$filename : string

Name of the file.

Return values
array<string|int, mixed>

        
On this page

Search results