setasign\SetaPDF2\Core\Image

WebP Class representing an WebP image

File: /SetaPDF v2/Core/Image/WebP.php

Internally the WebP format is handled through GD and converted to JPEG or PNG for further processing.

Class hierarchy

Summary

Constants

FORMAT_SIMPLE_EXTENDED

public const WebP::FORMAT_SIMPLE_EXTENDED = 'VP8X'

FORMAT_SIMPLE_LOSSLESS

public const WebP::FORMAT_SIMPLE_LOSSLESS = 'VP8L'

FORMAT_SIMPLE_LOSSY

public const WebP::FORMAT_SIMPLE_LOSSY = 'VP8 '

TYPE_GIF

public const string Image::TYPE_GIF = 'gif'

Image type

TYPE_JPEG

public const string Image::TYPE_JPEG = 'jpeg'

Image type

TYPE_JPEG2000

public const string Image::TYPE_JPEG2000 = 'jpeg2000'

Image type

TYPE_PNG

public const string Image::TYPE_PNG = 'png'

Image type

TYPE_TIFF

public const string Image::TYPE_TIFF = 'tiff'

Image type

TYPE_UNKNOWN

public const string Image::TYPE_UNKNOWN = 'unknown'

Image type

TYPE_WEBP

public const string Image::TYPE_WEBP = 'webp'

Image type


Properties

$_binaryReader

$_bitsPerComponent

protected int Image::$_bitsPerComponent = 8

Bits per component

$_colorSpace

protected int Image::$_colorSpace = -1

The image type specific colorspace

$_dpiX

protected int Image::$_dpiX = 0

Dots-per-inch in the X direction

$_dpiY

protected int Image::$_dpiY = 0

Dots-per-inch in the Y direction

$_format

protected string WebP::$_format

$_height

protected int Image::$_height

The pixel height

$_inverted

protected bool Image::$_inverted = false

Flag for color inversion

$_width

protected int Image::$_width

The pixel width

$jpegQuality

public int WebP::$jpegQuality = 85

The quality parameter passed to imagejpeg()


Static Methods

get()

Get an image by a reader.

Parameters
$reader: \setasign\SetaPDF2\Core\Reader\ReaderInterface

The reader instance

Exceptions

Throws \setasign\SetaPDF2\NotImplementedException If the image type is not supported (supported types: JPEG, PNG, JPEG2000).

getByPath()

public static Image::getByPath (
string $path
): Image

Get an image by a path.

Parameters
$path: string

The path to the image

getType()

Get an image type by a reader.

Parameters
$reader: \setasign\SetaPDF2\Core\Reader\ReaderInterface
 

Methods

__construct()

_process()

protected WebP::_process (
void
): void
Exceptions

Throws Exception

getBitsPerComponent()

public Image::getBitsPerComponent (
void
): int

Get the bits per component value.

getColorSpace()

WARNING: This method is marked as deprecated!

Should be moved to the individual image type implementation

public Image::getColorSpace (
void
): int|float

Get the image type specific colorspace.

getDpiX()

WARNING: This method is marked as deprecated!

public Image::getDpiX (
void
): int|float

Get the dots-per-inch in the X direction.

getDpiY()

WARNING: This method is marked as deprecated!

public Image::getDpiY (
void
): int|float

Get the dots-per-inch in the Y direction.

getHeight()

public Image::getHeight (
float $width = null
): int|float

Get the height.

Parameters
$width: float

Value for keeping the aspect ratio

getWidth()

public Image::getWidth (
float $height = null
): int|float

Get the width.

Parameters
$height: float

Value for keeping the aspect ratio

toXObject()

Converts the WebP image to an external object.

This is done by using GD for the conversion from WebP to either JPG or PNG.

Parameters
$document: \setasign\SetaPDF2\Core\Document
 
Exceptions

Throws \setasign\SetaPDF2\Core\Filter\Exception

Throws Exception

Throws \setasign\SetaPDF2\NotImplementedException

See