1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Backport of
From d77c01e560e973177feed4915ffd7dd1a45fd763 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Fri, 3 Feb 2023 09:33:01 -0500
Subject: [PATCH] move `-set profile` handler to CLI
--- imagemagick-6.9.11.60+dfsg.orig/magick/property.c
+++ imagemagick-6.9.11.60+dfsg/magick/property.c
@@ -4399,26 +4399,6 @@ MagickExport MagickBooleanType SetImageP
geometry=DestroyString(geometry);
break;
}
- if (LocaleCompare("profile",property) == 0)
- {
- ImageInfo
- *image_info;
-
- StringInfo
- *profile;
-
- image_info=AcquireImageInfo();
- (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
- (void) SetImageInfo(image_info,1,exception);
- profile=FileToStringInfo(image_info->filename,~0UL,exception);
- if (profile != (StringInfo *) NULL)
- {
- status=SetImageProfile(image,image_info->magick,profile);
- profile=DestroyStringInfo(profile);
- }
- image_info=DestroyImageInfo(image_info);
- break;
- }
status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
ConstantString(property),ConstantString(value));
break;
--- imagemagick-6.9.11.60+dfsg.orig/wand/mogrify.c
+++ imagemagick-6.9.11.60+dfsg/wand/mogrify.c
@@ -2840,7 +2840,23 @@ WandExport MagickBooleanType MogrifyImag
(void) SetImageArtifact(*image,argv[i+1]+7,value);
}
else
- (void) SetImageProperty(*image,argv[i+1],value);
+ if (LocaleCompare(argv[i+1],"profile") == 0)
+ {
+ StringInfo
+ *profile = (StringInfo *) NULL;
+
+ (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
+ (void) SetImageInfo(image_info,1,exception);
+ if (LocaleCompare(image_info->filename,"-") != 0)
+ profile=FileToStringInfo(image_info->filename,~0UL,exception);
+ if (profile != (StringInfo *) NULL)
+ {
+ status=SetImageProfile(image,image_info->magick,profile);
+ profile=DestroyStringInfo(profile);
+ }
+ }
+ else
+ (void) SetImageProperty(*image,argv[i+1],value);
value=DestroyString(value);
break;
}
|