AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
December 2003

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2003.12.19 07:14 "Reading and writing out TIFFTAG_CLIPPATH", by Jae Ho Lee
2003.12.19 08:18 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Andrey Kiselev
2003.12.19 13:09 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Leonard Rosenthol
2003.12.20 01:08 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Jae Ho Lee
2003.12.26 02:02 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Jae Ho Lee
2003.12.26 11:37 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Andrey Kiselev
2003.12.26 23:29 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Jae Ho Lee
2003.12.28 21:43 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Andrey Kiselev

2003.12.26 11:37 "Re: Reading and writing out TIFFTAG_CLIPPATH", by Andrey Kiselev

Hello,

On Fri, Dec 26, 2003 at 11:02:47AM +0900, Jae Ho Lee wrote:
> But I still could not write PHOTOSHOP tag data to newly created tiff
> image until I made below changes to TIFFWriteNormalTag() fuction in
> tif_dirwrite.c file.

I can't reproduce your problem with the file you sent to me. Attached
sample program works well and Photoshop tag is properly copied to the
output image.

-- 
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517


#include <stdio.h>
#include <stdlib.h>
#include "tiffio.h"

int main (int argc, char **argv)
{
    unsigned int i, count;
    TIFF *in, *out;
    uint16 spp, bpp, photo;
    uint32 image_width, image_height;
    char *buf, *photoshop;

    in = TIFFOpen(argv[1], "r");
    if (!in)
            {
            fprintf (stderr, "Can't open %s for reading\n", argv[1]);
            return 2;
            }

    TIFFGetField(in, TIFFTAG_IMAGELENGTH, &image_height);
    TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bpp);
    TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &spp);
    TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photo);

    TIFFGetField(in, TIFFTAG_PHOTOSHOP, &count, &photoshop);
    fprintf(stdout, "Photoshop tag length: %d\n", count);

    image_width = TIFFScanlineSize(in);
    buf = malloc(image_width * image_height);
    for (i = 0; i < image_height; i++)
        TIFFReadScanline(in, &buf[i * image_width], i, 0);

    out = TIFFOpen("out.in", "w");
    TIFFSetField(out, TIFFTAG_IMAGEWIDTH, image_width / spp);
    TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, bpp);
    TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, spp);
    TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
    TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photo);
    TIFFSetField(out, TIFFTAG_PHOTOSHOP, count, photoshop);
    TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(out, 0));
    for (i = 0; i < image_height; i++)
        TIFFWriteScanline(out, &buf[i * image_width], i, 0);

    TIFFClose(out);
    TIFFClose(in);

    return 0;
}