static TIFFExtendProc
tag_extender = (TIFFExtendProc) NULL;
+static void TIFFIgnoreTags(TIFF *tiff)
+{
+ char
+ *q;
+
+ const char
+ *p,
+ *tags;
+
+ Image
+ *image;
+
+ register ssize_t
+ i;
+
+ size_t
+ count;
+
+ TIFFFieldInfo
+ *ignore;
+
+ if (TIFFGetReadProc(tiff) != TIFFReadBlob)
+ return;
+ image=(Image *)TIFFClientdata(tiff);
+ tags=GetImageArtifact(image,"tiff:ignore-tags");
+ if (tags == (const char *) NULL)
+ return;
+ count=0;
+ p=tags;
+ while (*p != '\0')
+ {
+ while ((isspace((int) ((unsigned char) *p)) != 0))
+ p++;
+
+ (void) strtol(p,&q,10);
+ if (p == q)
+ return;
+
+ p=q;
+ count++;
+
+ while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
+ p++;
+ }
+ if (count == 0)
+ return;
+ i=0;
+ p=tags;
+ ignore=(TIFFFieldInfo *) AcquireQuantumMemory(count,sizeof(*ignore));
+ // This also sets field_bit to 0 (FIELD_IGNORE)
+ ResetMagickMemory(ignore,0,count*sizeof(*ignore));
+ while (*p != '\0')
+ {
+ while ((isspace((int) ((unsigned char) *p)) != 0))
+ p++;
+
+ ignore[i].field_tag=(ttag_t) strtol(p,&q,10);
+
+ p=q;
+ i++;
+
+ while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
+ p++;
+ }
+ (void) TIFFMergeFieldInfo(tiff,ignore,(uint32) count);
+ ignore=(TIFFFieldInfo *) RelinquishMagickMemory(ignore);
+}
+
static void TIFFTagExtender(TIFF *tiff)
{
static const TIFFFieldInfo
sizeof(*TIFFExtensions));
if (tag_extender != (TIFFExtendProc) NULL)
(*tag_extender)(tiff);
+ TIFFIgnoreTags(tiff);
}
#endif
(image_info->type != OptimizeType))
(void) SetImageType(image,image_info->type,exception);
compression=UndefinedCompression;
+ if (image->compression != JPEGCompression)
+ compression=image->compression;
if (image_info->compression != UndefinedCompression)
compression=image_info->compression;
switch (compression)
}
}
}
- if (photometric == PHOTOMETRIC_RGB)
- (void) TransformImageColorspace(image,sRGBColorspace,exception);
switch (image->endian)
{
case LSBEndian:
if (rows_per_strip < 1)
rows_per_strip=1;
if ((image->rows/rows_per_strip) >= (1UL << 15))
- rows_per_strip=(image->rows >> 15);
+ rows_per_strip=(uint32) (image->rows >> 15);
(void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,rows_per_strip);
if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0))
{