Thanks in advance for any wisdom shared.
I need (want) to dynamically create fairly simple tiff images in perl. I need tiffs of a specific demension, containing only text of a specified font (and size) at very specific locations. The images must be 600 DPI, one bit per sample (black text on a white background), with CCITT Group 4 Fax Compression.
I have tried using the Imager package, as it looked to best match my needs, but have not yet been able to get it to output 1 bit per sample, nor Group4 compression. Below is sample code using Imager:
#!/usr/local/bin/perl -w use strict; use Imager; my $impact = Imager::Font->new(file => '/home/me/test/IMPACT.ttf'); my $times = Imager::Font->new(file => '/home/me/test/times.ttf'); my $img = Imager->new(xsize=>5500, ysize=>6600, chanels=>1, class => ' +fax') || warn Imager->errstr; my $image = $img->to_paletted(colors=>[Imager::Color->new(255,255,255) +], class => 'fax', make_colors => 'none', translate => 'errdiff', errdiff => 'stucki') || die Imager->errstr; $image->string(text=>'14', x=>1750, 'y'=>1220, size=>1470, font=>$impa +ct, color=>'black', aa=>1, align=>0) or warn $image->errstr; $image->string(text=>'13716', x=>750, 'y'=>3100, size=>1450, font=>$im +pact, color=>'black', aa=>1, align=>0) or warn $image->errstr; $image->write(file=>'./foo.tif') or die $image->errstr; exit;
They say that time changes things, but you actually have to change them yourself.
Andy Warhol
In reply to Creating Tiff's from perl by JediWizard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |