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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.