ext/RMagick/rmimage.c in rmagick-1.15.13 vs ext/RMagick/rmimage.c in rmagick-1.15.14
- old
+ new
@@ -1,8 +1,8 @@
-/* $Id: rmimage.c,v 1.192.2.5.2.4 2007/12/21 15:17:58 rmagick Exp $ */
+/* $Id: rmimage.c,v 1.192.2.5.2.6 2008/05/05 22:59:40 rmagick Exp $ */
/*============================================================================\
-| Copyright (C) 2007 by Timothy P. Hunter
+| Copyright (C) 2008 by Timothy P. Hunter
| Name: rmimage.c
| Author: Tim Hunter
| Purpose: Image class method definitions for RMagick
\============================================================================*/
@@ -440,25 +440,32 @@
// GraphicsMagick code based on the code for the "-profile" option in command.c
Image *image, *profile_image;
ImageInfo *info;
ExceptionInfo exception;
+#if !defined(HAVE_IMAGE_IPTC_PROFILE)
+ ProfileInfo profile_info;
+#endif
char *profile_filename = NULL;
long profile_filename_l = 0;
- ProfileInfo *generic;
const unsigned char *profile;
size_t profile_l;
- long x;
rm_check_frozen(self);
Data_Get_Struct(self, Image, image);
// ProfileImage issues a warning if something goes wrong.
profile_filename = STRING_PTR_LEN(name, profile_filename_l);
info = CloneImageInfo(NULL);
+#if !defined(HAVE_IMAGE_IPTC_PROFILE)
+ profile_info.name="IPTC";
+ profile_info.info=(unsigned char *) GetImageProfile(image, profile_info.name, &profile_info.length);
+ info->client_data=&profile_info;
+#else
info->client_data= (void *) &image->iptc_profile;
+#endif
strncpy(info->filename, profile_filename, min(profile_filename_l, sizeof(info->filename)));
info->filename[MaxTextExtent-1] = '\0';
GetExceptionInfo(&exception);
profile_image = ReadImage(info, &exception);
@@ -476,10 +483,33 @@
{
goto done;
}
}
+#if defined(HAVE_ALLOCATEIMAGEPROFILEITERATOR)
+ /* GraphicsMagick 1.2 */
+ {
+ ImageProfileIterator profile_iterator;
+ const char *profile_name;
+ size_t profile_length;
+
+ profile_iterator = AllocateImageProfileIterator(profile_image);
+ while (NextImageProfile(profile_iterator, &profile_name, &profile, &profile_length) != MagickFail)
+ {
+ if ((rm_strcasecmp(profile_name, "ICC") == 0) || (rm_strcasecmp(profile_name, "ICM") == 0))
+ (void) ProfileImage(image, profile_name, (unsigned char *) profile, profile_length, True);
+ else
+ (void) SetImageProfile(image, profile_name, profile, profile_length);
+ }
+ DeallocateImageProfileIterator(profile_iterator);
+ }
+
+#else
+ {
+ long x;
+ ProfileInfo *generic;
+
/* ICC ICM Profile */
profile = GetImageProfile(profile_image, "ICM", &profile_l);
if (profile)
{
(void)SetImageProfile(image, "ICM", profile, profile_l);
@@ -497,10 +527,12 @@
if (image->exception.severity >= ErrorException)
{
break;
}
}
+ }
+#endif
done:
(void) DestroyImage(profile_image);
rm_check_image_exception(image, RetainOnError);
@@ -5572,22 +5604,22 @@
quantum_depth = image->depth;
#endif
x += sprintf(buffer+x, "%lu-bit", quantum_depth);
// Print blob info if appropriate.
- if (SizeBlob(image) != 0)
+ if (GetBlobSize(image) != 0)
{
- if (SizeBlob(image) >= (1 << 24))
+ if (GetBlobSize(image) >= (1 << 24))
{
- x += sprintf(buffer+x, " %lumb", (unsigned long) (SizeBlob(image)/1024/1024));
+ x += sprintf(buffer+x, " %lumb", (unsigned long) (GetBlobSize(image)/1024/1024));
}
- else if (SizeBlob(image) >= 1024)
+ else if (GetBlobSize(image) >= 1024)
{
- x += sprintf(buffer+x, " %lukb", (unsigned long) (SizeBlob(image)/1024));
+ x += sprintf(buffer+x, " %lukb", (unsigned long) (GetBlobSize(image)/1024));
}
else
{
- x += sprintf(buffer+x, " %lub", (unsigned long) SizeBlob(image));
+ x += sprintf(buffer+x, " %lub", (unsigned long) GetBlobSize(image));
}
}
assert(x < sizeof(buffer)-1);
buffer[x] = '\0';