Package DE_EPAGES::Core::API::Image
This module provides image functionality.
Example |
use DE_EPAGES::Core::API::Image qw( AddBorderToImage NewImage ...); |
@EXPORT_OK |
Functions
- AddBorderToImage
- CorrectImageColorSpace
- CreateIcon
- GetImageInfo
- NewImage
- ResizeImage
- ResizeImageUsingImageRef
- ScaleImage
- TestImage
- TestImageFormat
AddBorderToImage
Add a border with the given params to the image. - Add a border to the image. Then the new was renamed to the target image.
Syntax |
AddBorderToImage( $Target, $hParams); |
Example |
AddBorderToImage( "/tmp/image.gif", {'Height' => 150, 'Width' => 150, 'BGColor'=>'#FFFFFF'}); |
Input |
|
CorrectImageColorSpace
Converts the image color space to RGB if it is not yet an RGB image. Implemented for EPG-11560 to fix CMYK images. To save an additional $Image->Read($File) you can also supply a valid image magick object.
Syntax |
CorrectImageColorSpace( $File ); |
Example |
CorrectImageColorSpace( "/tmp/image.gif" ); |
Input |
|
CreateIcon
Creates icon from image, the icon includes 3 (16x16,32x32,64x64) sizes.
Syntax |
CreateIcon($Image, $Icon); |
Example |
CreateIcon($Shop->get('PublicPath').'/'.$Shop->get('Logo'), $Shop->get('PublicPath').'/'.'favicon.ico'); |
Input |
|
GetImageInfo
Returns ref.hash with mode, uid and gid for FileName (only unix).
Syntax |
$hImageInfo = GetImageInfo($FileName, $WithExif); |
Input |
|
Return |
|
NewImage
Create a new image with the given params.
Syntax |
NewImage( $Target, $hParams); |
Example |
NewImage( "/tmp/image.gif", {'Height' => 150, 'Width' => 150, 'BGColor'=>'#FFFFFF'}); |
Input |
|
ResizeImage
Creates a new image where the maximal width is $ScaleWidth and maximal height is $ScaleHeight.
Syntax |
ResizeImage( $Source, $Target, $ScaleWidth, $ScaleHeight, $Quality ); |
Example |
ResizeImage( "/tmp/image.gif", "/tmp/image2.gif", 320, 240, 80 ); |
Input |
|
ResizeImageUsingImageRef
Like the ResizeImage method, but uses an already open Image::Magick object reference instead of opening the source file. This can be useful when applying more than operation to the image, multiple resize operations for example.
Syntax |
ResizeImageUsingImageRef( $Image, $Source, $Target, $ImageWidth, $ImageHeight, $ScaleWidth, $ScaleHeight, $Quality ); |
Example |
ResizeImageUsingImageRef( $WorkImage, $Source, $Path.'/'.$Target, $ImageWidth, $ImageHeight, $hParams->{'SCALE_WIDTH_'.$Size}, $hParams->{'SCALE_HEIGHT_'. $Size}, $Quality ); |
Input |
|
ScaleImage
Creates a new image where the maximal width or height is $ScaleSize.
Syntax |
ScaleImage( $Source, $Target, $ScaleSize, $ScaleHeight, $Quality ); |
Example |
ScaleImage( "/tmp/image.gif", "/tmp/image2.gif", 80 ); |
Input |
|
TestImage
Throws the error INVALID_IMAGE_FILE if the file is not an image, that is understood by Image::Magick
Syntax |
TestImage($FilePath); |
Example |
TestImage('SourceFile.jpg'); |
Input |
|
TestImageFormat
Throws the error UNSUPPORTED_IMAGE_FORMAT if the file name has an extension that is not supported. Supported extensions are: bmp gif jpg jpeg png.
Syntax |
TestImageFormat($Parameter, $FilePath); |
Example |
TestImageFormat('SourceFile', $SourceFile); |
Input |
|