Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

TIFF Perl Module needed

by monsieur_champs (Curate)
on Jun 04, 2003 at 17:55 UTC ( #263083=perlquestion: print w/ replies, xml ) Need Help??
monsieur_champs has asked for the wisdom of the Perl Monks concerning the following question:

Peace and glory, fellow monks.

Does anybody knows about a Perl Module that handles the complete TIFF format specification?

I'm having a bad time trying to find this on CPAN

May the gods bless you.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Just Another Perl Monk

Comment on TIFF Perl Module needed
Re: TIFF Perl Module needed
by tall_man (Parson) on Jun 04, 2003 at 18:23 UTC

      Sorry fellow, this one doesn't is implemented. =-]

      Thank you very much for care.

      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      Just Another Perl Monk

Re: TIFF Perl Module needed
by halley (Prior) on Jun 04, 2003 at 18:45 UTC

    You'll quite likely find nothing in pure Perl that deals with all the intricacies of TIFF, but you'll find many varieties which offer some limited exposure to the libtiff native C library. These are usually trying to homogenize the interfaces of many image formats at once.

    Can you give more details about what you're trying to accomplish?

    --
    [ e d @ h a l l e y . c c ]

      Well, this is somewhat a long history... please be patient.

      I manage a fax web service, where folks can send faxes using the email.

      Its possible to receive faxes too. Faxes are received by a lower level mechanism and transformed into TIFF's. Those files suffer from a printing problem: when the sending fax don't separate pages, I receive a long page (usually containing the whole fax as a single image, with a very long lenght (in Y axis).

      As usual, my users don't know how to handle this kind of fax-transmittion-disfunction, and I need to resize / rotate / scale / crop images so they fit inside one or more A4 pages. Otherwise, 95% of my users are simply unable to print the faxes they receive.

      As my first approximation, I need just to crop the TIFF's so they can vertically fit into one or more A4 format pages. After this works, I will try to figure out how to make other transformations as needed.

      Could you please help me? I'm nearly desperate.

      May the gods bless you, fellow.

      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      Just Another Perl Monk

        This sounds eerily like a program I wrote for a client a few years ago (but no longer have access). I called it "the butcher." Trim the fat margins, find the best cutting strategy to give some overlap on each tiled page.

        That said, I'd have you look at ImageMagick, which has some support for the basic operations, and works very well with TIFF files. You may find you can script everything from the command line, or you may find the PerlMagick bindings to be useful.

        TIFF isn't the problem, it's just an implementation detail. The problem is deciding what to do with those big images to make them into something your users can use.

        --
        [ e d @ h a l l e y . c c ]

Re: TIFF Perl Module needed
by cees (Curate) on Jun 04, 2003 at 18:46 UTC

    It might help if you tell us what it is you are trying to accomplish.

    If you want to edit a TIFF file in perl, then it might be easier to convert it to another format, make your changes, and then convert it back. This should be possible in a lossless way.

    I would recommend you look at the PBM/PGM/PPM format as a simple image format that can be converted to and from pretty much any other image format. Check out the Image::PBMlib module and the NetPBM package which contains tiff conversion utilities including tifftopnm and pnmtotiff.

      A nice suggestion.

      I will check out the modules you mentioned right now.

      I think I've told all the history to halley, at this node. Please read it on.

      Thank you very much for care, fellow.

      May the gods bless you.

      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      Just Another Perl Monk

Re: TIFF Perl Module needed
by Juerd (Abbot) on Jun 04, 2003 at 19:01 UTC

    Depending on what you want to do with it, Imager may or may not be useful. It handles the format specification using libtiff, but doesn't provide direct access to those functions. If you need a wrapper around libtiff, you could of course try Inline::C if you can't find a module that does exactly what you want.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re: TIFF Perl Module needed
by fglock (Vicar) on Jun 04, 2003 at 20:39 UTC

    Good day, fellow Perl Monk.

    I use the command line mode of ImageMagick for this kind of tasks.

    The commands you want are identify and convert.

    You can call them from Perl using backticks:

    @info = `identify $filename`;

    See man identify and man convert.

Re: TIFF Perl Module needed
by gregor (Initiate) on May 01, 2012 at 13:31 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://263083]
Approved by tall_man
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-12-28 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (181 votes), past polls