Combine every 2 TIF's into one

Discussion in 'Scanners' started by Gema Gema, Jul 2, 2003.

  1. Gema Gema

    Gema Gema Guest

    I have an odd situation, and am wondering if there is an easy shortcut to
    help get it done faster. I have a large series of files consisting of
    single page TIF files generated from scanned images. These files are named
    in a sequential way with "a" or "b" after each number...ie.... 0001a.tif,
    0001b.tif, 0002a.tif, 0002b.tif, etc.. I need to combine the "a" files with
    the "b" files to make one multi-page TIF file. (0001a.tif + 0001b.tif
    becomes 0001.tif) I have software which does this (Infothek Reformat), but
    the individual files must be manually highlighted to combine them. Since
    the pattern of every 2 files becoming 1 is constant, I was wondering if
    there is any way to accomplish this in an automated way.

    Thank you.
     
    Gema Gema, Jul 2, 2003
    #1
    1. Advertisements

  2. If you're running on a Unix or Linux system, it's pretty trivial to
    do something like this.

    To do the actual image merging, I'd probably just use the PBMPLUS
    toolkit, unless there was a huge number of files. Just convert each of
    the two TIFF files into PBM format, paste them together side-by-side (I
    think the command to do this is pnmcat), then convert the result back to
    TIFF. Repeat for each filename.

    For faster processing, write a piece of software that reads both images
    using LIBTIFF, merges the data scanline by scanline, and writes it out
    again using LIBTIFF. But don't do this unless the PBMPLUS tools are too
    slow.

    As for generating a sequential list of filenames and merging each one in
    sequence, I'd probably write a small awk or perl script that prints out
    a sequence of commands (tifftopnm, pnmcat, pnmtotiff) with the right
    filenames, then pipe that into a shell to run the commands.

    All of these tools are probably already sitting there ready to use on a
    Unix or Linux system. For MacOS X, you may have to find and install
    some pieces. For Windows, the cygwin environment provides enough of the
    necessary Unix-like pieces to do the same thing.

    Dave
     
    Dave Martindale, Jul 2, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.