PyrImageSpec.pm

Summary
PyrImageSpec.pm
BE4::PyrImageSpecStore all image’s components.
IMAGESPECDefine allowed values for attributes interpolation, compression and compressionoption.
DEFAULTDefine default values for attributes interpolation, compression, compressionoption and gamma.
SAMPLEFORMAT2CODEConvert the sample format parameter to the code element.
CODESDefine all available formats’ codes, and parse them.
Constructors
newPyrImageSpec constructor.
_initChecks and stores informations.
Attributes’ testers
isCompressionTests if compression value is allowed.
isCompressionOptionTests if compression option value is allowed, and consistent with the compression.
isInterpolationTests if interpolation value is allowed.
Code manager
decodeFormatExtracts bits per sample, compression and sample format from a code (present in pyramid’s descriptor).
Getters - Setters
getInterpolation
getGamma
getCompression
getCompressionOption
getFormatCode
getPixel
Export methods
exportForDebugReturns all image’s components.

BE4::PyrImageSpec

Exporter
BE4::PyrImageSpec

Store all image’s components.

Using

use BE4::PyrImageSpec;

# PyrImageSpec object creation

# Basic constructor
my $objPIS = BE4::PyrImageSpec->new({
    compression => "raw",
    sampleformat => "uint",
    bitspersample => 8,
    samplesperpixel => 3,
    photometric => "rgb",
    compressionoption => "none",
    interpolation => "bicubic",
    gamma  => 1
});

# From a code
my $objPIS = BE4::PyrImageSpec->new({
    formatCode => "TIFF_RAW_INT8",
    samplesperpixel => 3,
    photometric => "rgb",
    compressionoption => "none",
    interpolation => "bicubic",
    gamma  => 1
});

Attributes

pixelPixel - Contains pixel intrinsic components.
compressionstring - Data compression.  Only PNG is a unofficial TIFF compression.
compressionoptionstring - Precise additionnal actions, to do before compression.  Just “crop” is available, with JPEG compression.  It’s allowed to empty blocs which contain white pixel, to keep pure white, even with JPEG compression.
interpolationstring - Image could be resampling.  Resampling use a kind of interpolation.
gammafloat - Positive, used by merge4tiff to make dark (between 0 and 1) or light (greater than 1) RGB images.  1 is a neutral value.
formatCodestring - Used in the pyramid’s descriptor.  Format is : TIFF_<COMPRESSION>_<SAMPLEFORMAT><BITSPERSAMPLE> (TIFF_RAW_INT8).
Summary
IMAGESPECDefine allowed values for attributes interpolation, compression and compressionoption.
DEFAULTDefine default values for attributes interpolation, compression, compressionoption and gamma.
SAMPLEFORMAT2CODEConvert the sample format parameter to the code element.
CODESDefine all available formats’ codes, and parse them.
Constructors
newPyrImageSpec constructor.
_initChecks and stores informations.
Attributes’ testers
isCompressionTests if compression value is allowed.
isCompressionOptionTests if compression option value is allowed, and consistent with the compression.
isInterpolationTests if interpolation value is allowed.
Code manager
decodeFormatExtracts bits per sample, compression and sample format from a code (present in pyramid’s descriptor).
Getters - Setters
getInterpolation
getGamma
getCompression
getCompressionOption
getFormatCode
getPixel
Export methods
exportForDebugReturns all image’s components.

IMAGESPEC

my %IMAGESPEC

Define allowed values for attributes interpolation, compression and compressionoption.

DEFAULT

my %DEFAULT

Define default values for attributes interpolation, compression, compressionoption and gamma.

SAMPLEFORMAT2CODE

my %SAMPLEFORMAT2CODE

Convert the sample format parameter to the code element.

CODES

my %CODES

Define all available formats’ codes, and parse them.

Constructors

new

sub new

PyrImageSpec constructor.  Bless an instance.

Parameters (hash)

formatCodestring - Format code, present in the pyramid’s descriptor.  If formatCode is provided, it has priority and overwrite other parameters.

OR

compressionstring - Image’s compression
sampleformatstring - Image’s sample format
bitspersampleinteger - Image’s bits per sample
samplesperpixelinteger - Image’s samples per pixel
photometricstring - Image’s photometric
compressionoptionstring - Image’s compression option
interpolationstring - Image’s interpolation
gammafloat - Merge gamma

See also

_init

_init

sub _init

Checks and stores informations.

Parameters (hash)

formatCodestring - Format code, present in the pyramid’s descriptor.  If formatCode is provided, it has priority and overwrite other parameters.

OR

compressionstring - Image’s compression
sampleformatstring - Image’s sample format
bitspersampleinteger - Image’s bits per sample
samplesperpixelinteger - Image’s samples per pixel
photometricstring - Image’s photometric
compressionoptionstring - Image’s compression option
interpolationstring - Image’s interpolation
gammafloat - Merge gamma

Attributes’ testers

isCompression

sub isCompression

Tests if compression value is allowed.

Parameters (list)

compressionstring - Compression value to test

isCompressionOption

sub isCompressionOption

Tests if compression option value is allowed, and consistent with the compression.

Parameters (list)

compressionoptionstring - Compression option value to test

isInterpolation

sub isInterpolation

Tests if interpolation value is allowed.

Parameters (list)

interpolationstring - Interpolation value to test

Code manager

decodeFormat

sub decodeFormat

Extracts bits per sample, compression and sample format from a code (present in pyramid’s descriptor).  Returns a list : (compression, sample format, bits per sample) : (“png”, “uint”, 8), undef if error.

Parameters (list)

formatCodeTIFF_INT8 and TIFF_FLOAT32 are deprecated, but handled (warnings) .

Getters - Setters

getInterpolation

sub getInterpolation

getGamma

sub getGamma

getCompression

sub getCompression

getCompressionOption

sub getCompressionOption

getFormatCode

sub getFormatCode

getPixel

sub getPixel

Export methods

exportForDebug

sub exportForDebug

Returns all image’s components.  Useful for debug.

Example

Object BE4::PyrImageSpec :
     Global information :
            - Compression : raw
            - Compression option : none
            - Interpolation : bicubic
            - Gamma : 1
            - Format code : TIFF_RAW_INT8
     Pixel components :
Object BE4::Pixel :
     Bits per sample : 8
     Photometric : rgb
     Sample format : uint
     Samples per pixel : 1
my %IMAGESPEC
Define allowed values for attributes interpolation, compression and compressionoption.
my %DEFAULT
Define default values for attributes interpolation, compression, compressionoption and gamma.
my %SAMPLEFORMAT2CODE
Convert the sample format parameter to the code element.
my %CODES
Define all available formats’ codes, and parse them.
sub new
PyrImageSpec constructor.
sub _init
Checks and stores informations.
sub isCompression
Tests if compression value is allowed.
sub isCompressionOption
Tests if compression option value is allowed, and consistent with the compression.
sub isInterpolation
Tests if interpolation value is allowed.
sub decodeFormat
Extracts bits per sample, compression and sample format from a code (present in pyramid’s descriptor).
sub getInterpolation
sub getGamma
sub getCompression
sub getCompressionOption
sub getFormatCode
sub getPixel
sub exportForDebug
Returns all image’s components.
Store all pixel’s intrinsic components.
Close