
Thread
2003.12.26 02:02 "Re: [Tiff] Reading and writing out TIFFTAG_CLIPPATH", by Jae Ho Lee
Hi,
I want to let you that I solved this problem with a minor change to libtiff.
My problem was that I was looking for ClipPath(343) tag which was not part of sample tiff I was working with.
Sample tiff contained TIFFTAG_PHOTOSHOP(34377).
So, instead of trying to fetch clippath and write it out, I opted to fetch whole photoshop data and write it out.
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.
Thanks for the feedbacks and help.
Regards,
Jae Ho
// jaeho - 20031224
// moved TIFF_BYTE case statement to TIFF_UNDEFINED because
TIFFTAG_PHOTOSHOP tag couldn't be written.
// when tag is TIFFTAG_PHOTOSHOP, 1) is executed but returned
value for wc is zero
// and no data is written for TIFFTAG_PHOTOSHOP tag.
// 2) should be executed to write TIFFTAG_PHOTOSHOP data
correctly but I opted to execute 3) instead.
// case TIFF_BYTE:
case TIFF_SBYTE:
if (wc > 1) {
char* cp;
if (wc == (u_short) TIFF_VARIABLE
||
fip->field_passcount) {
TIFFGetField(tif,
fip->field_tag, &wc, &cp); // 1) when tag is
TIFFTAG_PHOTOSHOP; wc = 0
dir->tdir_count
= wc;
} else if (wc == (u_short) TIFF_VARIABLE2) {
TIFFGetField(tif,
fip->field_tag, &wc2, &cp); // 2) when tag is
TIFFTAG_PHOTOSHOP
dir->tdir_count
= wc2;
} else
TIFFGetField(tif,
fip->field_tag, &cp);
if (!TIFFWriteByteArray(tif, dir, cp))
return
(0);
} else {
if (fip->field_passcount) {
char*
cp;
TIFFGetField(tif,
fip->field_tag, &wc, &cp);
dir->tdir_count
= wc;
if
(!TIFFWriteByteArray(tif, dir, cp))
return
0;
} else {
char
cv;
TIFFGetField(tif,
fip->field_tag, &cv);
if
(!TIFFWriteByteArray(tif, dir, &cv))
return
(0);
}
}
break;
// jaeho - 20031224
// added TIFF_BYTE to support TIFFTAG_PHOTOSHOP
case TIFF_BYTE:
case TIFF_UNDEFINED:
{ char* cp;
if (wc == (u_short) TIFF_VARIABLE) {
TIFFGetField(tif, fip->field_tag, &wc,
&cp);
dir->tdir_count = wc;
} else if (wc == (u_short) TIFF_VARIABLE2) {
TIFFGetField(tif, fip->field_tag, &wc2,
&cp); // 3) when tag is
TIFFTAG_PHOTOSHOP
dir->tdir_count = wc2;
} else
TIFFGetField(tif, fip->field_tag,
&cp);
if (!TIFFWriteByteArray(tif, dir, cp))
return (0);
}
break;
case TIFF_NOTYPE:
break;
}
2003. 12. 20, 오전 10:08, Jae Ho Lee 작성:
Thanks for your feedbacks and help.
I guess there is no easy solution to this for now.
As suggested, I will look at both PhotoShop SDK and ImageMagick/GraphisMagick
for further investigation.
Thanks again.
2003. 12. 19, 오후 10:09, Leonard Rosenthol 작성:
> At 4:14 PM +0900 12/19/03, Jae Ho Lee wrote:
>> I found out about libtiff while trying to create a low
>> resolution(72dpi) tiff image from a high resolution tiff image and
>> copy the clippath tag along.
>
> If you are scaling the image, you will also need to scale the
> clippath - NOT just copy it since the values are all wrong now...
>
> There is code in ImageMagick/GraphicsMagick for reading/parsing the> clippath to make it into a useable format (SVG), though we don't > currently write the clippath back out...
>> ----------------------------------------------------------------------
>> -----
Leonard Rosenthol <mailto:leonardr@pdfsages.com>
Chief Technical Officer <http://www.pdfsages.com>
PDF Sages, Inc. 215-629-3700 (voice)
215-629-0789 (fax)
>> __________________________