2011.04.22 20:24 "[Tiff] Question regarding toggling associated to unspecified", by Billy G. Alexander

I'm currently working on a old photogrammetric package that is using libtiff v3.9.0 however our client is requesting that we toggle the associated alpha tag 338 1 to 0 for compatibility with certain other software they have.

Is anyone familiar with a command line parameter or filter that has been implemented to toggle associated_alpha to Unspecified 1 to 0 during a batch routine for thousands of tif images....

I am new to this entire process I'm a little sketchy.

I welcome comments suggestions and direction...

If not does anyone foresee any issues if I was to implement the following in my extract.c that calls littiff. I realise i probably haven't provided you with enough information as yet but hopefully someone will see my intent and direction
By doing this i am hoping to implement a command line parameter in my script file.

{
 /* Typedef statements */

/* Struct, union, and enum definitions */

/* Static declarations */
static char
 routine_name[] = "tif_toggle_alpha";

/* Auto declarations */
int_4
 ii; /* Generic counter */

u_char
 *idx;

TIFF

   *tifb;                       /* TIF data buffer */

/* Verify the image format */
IMA_CHECK_OLD_TILE(dt);

/* Set the messages handlers */
tif_set_message_handlers();

/* Open the TIFF file for writing. */
tifb = TIFFOpen(pathname, "w");
if(tifb == NULL)
{
  sprintf(msg_buff, "Unable to open TIFF file!\n [file: %s]\n", pathname);
  TIF_LOG_ERR(msg_buff);
  return(ASI_STATUS_ERR);
}

/* Update TIFF IFD. */
TIFFSetField(tifb, TIFFTAG_EXTRASAMPLES, 0);

/* Output the TIFF image. */
for(ii = 0; ii < (int_4)dt->ny; ii++)
{
  idx = (u_char *)dt->pix2 + ( ii * dt->nx);
  if(TIFFWriteScanline(tifb, idx, ii, 0) < 0)
  {
    TIF_LOG_ERR("Failed to write TIFF scanline.\n");
    TIFFClose(tifb);
    return(ASI_STATUS_ERR);
  }
}

/* Close the TIFF file. */
TIFFClose(tifb);

  return( ASI_STATUS_SUC);
}