forked from Lainports/freebsd-ports
by others. Also make use of the author's own self-test suit. PR: 196161 Approved by: maintainer timeout
26 lines
1.3 KiB
Text
26 lines
1.3 KiB
Text
See https://sourceforge.net/p/openil/patches/43/
|
|
|
|
This patch will cause TIFFs with only a single color channel to be
|
|
saved as such, rather than as RGB.
|
|
|
|
--- src-IL/src/il_tiff.c (revision 1663)
|
|
+++ src-IL/src/il_tiff.c (working copy)
|
|
@@ -987,11 +987,15 @@
|
|
TIFFSetField(File, TIFFTAG_IMAGEWIDTH, TempImage->Width);
|
|
TIFFSetField(File, TIFFTAG_IMAGELENGTH, TempImage->Height);
|
|
TIFFSetField(File, TIFFTAG_COMPRESSION, Compression);
|
|
- TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
|
+ if((TempImage->Format == IL_LUMINANCE) || (TempImage->Format == IL_LUMINANCE_ALPHA))
|
|
+ TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
|
+ else
|
|
+ TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
|
TIFFSetField(File, TIFFTAG_BITSPERSAMPLE, TempImage->Bpc << 3);
|
|
TIFFSetField(File, TIFFTAG_SAMPLESPERPIXEL, TempImage->Bpp);
|
|
- if (TempImage->Bpp == 4) //TODO: LUMINANCE, LUMINANCE_ALPHA
|
|
- TIFFSetField(File, TIFFTAG_MATTEING, 1);
|
|
+ if ((TempImage->Bpp == ilGetBppFormat(IL_RGBA)) ||
|
|
+ (TempImage->Bpp == ilGetBppFormat(IL_LUMINANCE_ALPHA)))
|
|
+ TIFFSetField(File, TIFFTAG_EXTRASAMPLES, EXTRASAMPLE_ASSOCALPHA);
|
|
TIFFSetField(File, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
TIFFSetField(File, TIFFTAG_ROWSPERSTRIP, 1);
|
|
TIFFSetField(File, TIFFTAG_SOFTWARE, ilGetString(IL_VERSION_NUM));
|