NAME
IIIF::Magick - transform image with IIIF Image API Request using Image Magick
SYNOPSIS
use IIIF::Magick qw(info convert);
my $info = info($file, profile => "level0", id => "...") ;
convert( $request, $file, "target.png" );
DESCRIPTION
This module maps IIIF ImageAPI request parameters to ImageMagick command line arguments. See i3f (command line) and IIIF::ImageAPI (web service) for applications that make use of it.
REQUIREMENTS
Function info
and convert
require ImageMagick to be installed. Converting to PDF and/or WebP may not be enabled by default. For instance at Ubuntu Linux remove the line
<policy domain="coder" rights="none" pattern="PDF" />
fro /etc/ImageMagick*/policy.xml
and install WebP support via:
sudo apt-get install webp libwebp-dev
FUNCTIONS
available
Returns whether ImageMagick is available.
info( $file [, id => $id ] [, profile => $profile ] )
Returns image information object with fields @context
, type
, profile
, width
, and height
. Fields id
and profile
must be added for full IIIF compliance.
convert( $request, $file, $output [, @args ] )
Convert an image file as specified with a IIIF::Request into an output file. Returns true on success. Additional arguments are prepended to the call of ImageMagick's convert
.
Requires at least ImageMagick 6.9.
convert_command( $request, $file, $output [, @args ] )
Get a shell-quoted command to convert an image with a IIIF::Request.
convert_args( $request )
Get the list of command line arguments to convert
to transform an image file as specified via a IIIF::Request.
LIMITATIONS
The upscale option of size parameter is ignored: size ^max
will not upscale the image as the resulting size depends on additional variables maxWidth
, maxHeight
, maxArea
.
The IIIF Image API Request is not validated before processing. Sizes larger than the selected region will therefore always result in an upscaled image. Use method canonical
of IIIF::Request to filter out such invalid requests.