Skip to content
Permalink
Browse files Browse the repository at this point in the history
https://github.com/ImageMagick/ImageMagick/issues/298
  • Loading branch information
Cristy committed Nov 9, 2016
1 parent b1c2114 commit b61d35e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
4 changes: 2 additions & 2 deletions MagickCore/property.c
Expand Up @@ -213,7 +213,7 @@ MagickExport MagickBooleanType CloneImageProperties(Image *image,
%
% DefineImageProperty() associates an assignment string of the form
% "key=value" with an artifact or options. It is equivelent to
% SetImageProperty()
% SetImageProperty().
%
% The format of the DefineImageProperty method is:
%
Expand Down Expand Up @@ -3962,7 +3962,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
{
/*
Do not 'set' single letter properties - read only shorthand.
*/
*/
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
Expand Down
43 changes: 28 additions & 15 deletions coders/tiff.c
Expand Up @@ -631,42 +631,54 @@ static void TIFFGetProperties(TIFF *tiff,Image *image,ExceptionInfo *exception)
unsigned long
*tietz;


if (TIFFGetField(tiff,TIFFTAG_ARTIST,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_ARTIST,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:artist",text,exception);
if (TIFFGetField(tiff,TIFFTAG_COPYRIGHT,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_COPYRIGHT,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:copyright",text,exception);
if (TIFFGetField(tiff,TIFFTAG_DATETIME,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_DATETIME,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:timestamp",text,exception);
if (TIFFGetField(tiff,TIFFTAG_DOCUMENTNAME,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_DOCUMENTNAME,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:document",text,exception);
if (TIFFGetField(tiff,TIFFTAG_HOSTCOMPUTER,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_HOSTCOMPUTER,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:hostcomputer",text,exception);
if (TIFFGetField(tiff,TIFFTAG_IMAGEDESCRIPTION,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_IMAGEDESCRIPTION,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"comment",text,exception);
if (TIFFGetField(tiff,TIFFTAG_MAKE,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_MAKE,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:make",text,exception);
if (TIFFGetField(tiff,TIFFTAG_MODEL,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_MODEL,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:model",text,exception);
if (TIFFGetField(tiff,TIFFTAG_OPIIMAGEID,&count,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_OPIIMAGEID,&count,&text) == 1) &&
(text != (char *) NULL))
{
if (count >= MagickPathExtent)
count=MagickPathExtent-1;
(void) CopyMagickString(message,text,count+1);
(void) SetImageProperty(image,"tiff:image-id",message,exception);
}
if (TIFFGetField(tiff,TIFFTAG_PAGENAME,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_PAGENAME,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"label",text,exception);
if (TIFFGetField(tiff,TIFFTAG_SOFTWARE,&text) == 1)
if ((TIFFGetField(tiff,TIFFTAG_SOFTWARE,&text) == 1) &&
(text != (char *) NULL))
(void) SetImageProperty(image,"tiff:software",text,exception);
if (TIFFGetField(tiff,33423,&count,&text) == 1)
if ((TIFFGetField(tiff,33423,&count,&text) == 1) &&
(text != (char *) NULL))
{
if (count >= MagickPathExtent)
count=MagickPathExtent-1;
(void) CopyMagickString(message,text,count+1);
(void) SetImageProperty(image,"tiff:kodak-33423",message,exception);
}
if (TIFFGetField(tiff,36867,&count,&text) == 1)
if ((TIFFGetField(tiff,36867,&count,&text) == 1) &&
(text != (char *) NULL))
{
if (count >= MagickPathExtent)
count=MagickPathExtent-1;
Expand Down Expand Up @@ -695,7 +707,8 @@ static void TIFFGetProperties(TIFF *tiff,Image *image,ExceptionInfo *exception)
default:
break;
}
if (TIFFGetField(tiff,37706,&length,&tietz) == 1)
if ((TIFFGetField(tiff,37706,&length,&tietz) == 1) &&
(tietz != (unsigned long *) NULL))
{
(void) FormatLocaleString(message,MagickPathExtent,"%lu",tietz[0]);
(void) SetImageProperty(image,"tiff:tietz_offset",message,exception);
Expand Down
3 changes: 1 addition & 2 deletions coders/txt.c
Expand Up @@ -793,8 +793,7 @@ static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image,
(void) WriteBlobString(image,buffer);
(void) CopyMagickString(tuple,"(",MagickPathExtent);
if (pixel.colorspace == GRAYColorspace)
ConcatenateColorComponent(&pixel,GrayPixelChannel,compliance,
tuple);
ConcatenateColorComponent(&pixel,GrayPixelChannel,compliance,tuple);
else
{
ConcatenateColorComponent(&pixel,RedPixelChannel,compliance,tuple);
Expand Down

0 comments on commit b61d35e

Please sign in to comment.