From cf7dc08636a7679fbdfac7a8f7d4af0f78708578 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 11 Jun 2022 16:20:20 -0400 Subject: [PATCH] support date:timestamp property --- coders/tiff.c | 16 ++++++++++------ magick/constitute.c | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/coders/tiff.c b/coders/tiff.c index 6fd22e13a1..e278ca7c0a 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -3214,6 +3214,16 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } } + option=GetImageOption(image_info,"quantum:polarity"); + if (option == (const char *) NULL) + option=GetImageArtifact(image,"tiff:photometric"); + if (option != (const char *) NULL) + { + if (LocaleCompare(option,"min-is-black") == 0) + SetQuantumMinIsWhite(quantum_info,MagickFalse); + if (LocaleCompare(option,"min-is-white") == 0) + SetQuantumMinIsWhite(quantum_info,MagickTrue); + } if ((LocaleCompare(image_info->magick,"PTIF") == 0) && (GetPreviousImageInList(image) != (Image *) NULL)) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE); @@ -3227,17 +3237,11 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, case FaxCompression: { compress_tag=COMPRESSION_CCITTFAX3; - option=GetImageOption(image_info,"quantum:polarity"); - if (option == (const char *) NULL) - SetQuantumMinIsWhite(quantum_info,MagickTrue); break; } case Group4Compression: { compress_tag=COMPRESSION_CCITTFAX4; - option=GetImageOption(image_info,"quantum:polarity"); - if (option == (const char *) NULL) - SetQuantumMinIsWhite(quantum_info,MagickTrue); break; } #if defined(COMPRESSION_JBIG) diff --git a/magick/constitute.c b/magick/constitute.c index 6d52f06e14..9984e7683b 100644 --- a/magick/constitute.c +++ b/magick/constitute.c @@ -829,6 +829,8 @@ MagickExport Image *ReadImage(const ImageInfo *image_info, } if (source_date_epoch == (const char *) NULL) { + (void) FormatMagickTime(GetMagickTime(),MaxTextExtent,timestamp); + (void) SetImageProperty(next,"date:timestamp",timestamp); (void) FormatMagickTime((time_t) GetBlobProperties(next)->st_mtime, MaxTextExtent,timestamp); (void) SetImageProperty(next,"date:modify",timestamp);