I did ... but not in the way it is specified in the manual of Imager::Files. Thanks for hinting it is possible as I was convinced it wasn't and did not perservere with the manuals ... (maybe they should put this important info under the heading read() or in the Description section of mod:://Imager). The following works for me:
use strict; use warnings; use Imager; use Imager::Filter::Autocrop; my $imgdata = undef; open(IN, '<', 'example.jpg'); binmode(IN); { local $/ = undef; $imgdata = <IN> } close(IN); my $img = Imager->new(); # possible params are 'file', 'data' and 'fd' $img->read(data=>\$imgdata) or die "read: ".$img->errstr(); $img->filter(type=>'autocrop', fuzz=>20) or die "autocrop: ".$img->err +str(); $img->write(file=>'out.jpg') or die "writing: ".$img->errstr();
Edit: actually it is not documented in Imager::Files that data is a recognised input param name for read(). It is only mentioned in the write(). Anyway, all well now.
In reply to Re^2: Imager : read image from scalar (not from file)
by bliako
in thread Imager : read image from scalar (not from file)
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |