AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.08.04 23:42 "[Tiff] RE: NEWBIE HELP NEEDED: Efficiently changing orientation tags in multipage tiff files", by Bradley Feldman
2005.08.04 23:50 "Re: [Tiff] RE: NEWBIE HELP NEEDED: Efficiently changing orientationtags in multipage tiff files", by Joris
2005.08.04 15:36 "Re: [Tiff] tiff unknown field of tag", by Steven Woody
2005.08.04 14:45 "[Tiff] tiff unknown field of tag", by Steven Woody
2005.08.04 15:08 "Re: [Tiff] tiff unknown field of tag", by Frank Warmerdam
2005.08.04 15:26 "Re: [Tiff] tiff unknown field of tag", by Steven Woody
2005.08.04 15:10 "Re: [Tiff] tiff unknown field of tag", by Bob Friesenhahn
2005.08.04 15:33 "Re: [Tiff] tiff unknown field of tag", by Steven Woody
2005.08.04 15:10 "Re: [Tiff] tiff unknown field of tag", by Joris
2005.08.04 15:36 "RE: [Tiff] tiff unknown field of tag", by Bob Young
2005.08.04 18:05 "Re: [Tiff] tiff unknown field of tag", by Andrey Kiselev
2005.08.04 18:07 "Re: [Tiff] tiff unknown field of tag", by Andrey Kiselev
2005.08.05 00:33 "Re: [Tiff] tiff unknown field of tag", by Steven Woody

2005.08.04 23:42 "[Tiff] RE: NEWBIE HELP NEEDED: Efficiently changing orientation tags in multipage tiff files", by Bradley Feldman

Hey all -- Here's an update:

I pretty much found what I need by looking at how the source code for tiffsplit works, then adapting it to write multipage output with altered tags.

Thanks anyhow for the help.

*Bradley

-----Original Message-----

From: Bradley Feldman [mailto:bradley@relevantevidence.com] Sent: Thursday, August 04, 2005 4:03 PM To: 'tiff@lists.maptools.org'

Subject: NEWBIE HELP NEEDED: Efficiently changing orientation tags in multipage tiff files

Hi all:

I'm new to this library and this list and looking for some helpful tips on
writing a routine to quickly and efficiently change the orientation tag of
every page of a multipage file.

I see plenty of examples with single page files, but nothing with
multipagers.

As a primer, I've experimented with tiffset but found it only effects the
first page of a multitiff file.

Likewise, I've written a program that is basically simple loop that reads a
tiff file's directories, sets the orientation tag and writes out the
directory to a new file, but I'm not getting any image data. How so do I
get the whole input file, page by page with just the orientation changed to
the output file? I'm obviously missing some steps

Here's some pseudo code I'm using:

  infile = TIFFOpen("input.tif", "r");
  outfile = TIFFOpen("output.tif", "w");
   do {
      TIFFGetFieldDefaulted(infile, TIFFTAG_ORIENTATION, &orientation);
        orientation = newValue;
      TIFFSetField(infile, TIFFTAG_ORIENTATION, orientation);
      if (!TIFFWriteDirectory(outfile)) {
        printf("Error!");
         (void) TIFFClose(outfile);
         (void) TIFFClose(infile);
         exit (-2);
      }
   } while(TIFFReadDirectory(infile));
   TIFFClose(infile);
   TIFFClose(outfile);

Many thanks in advance for any help you can provide me with!

*Bradley