diff --git a/MagickCore/image.c b/MagickCore/image.c
index aa7eda7..363f87b 100644
--- a/MagickCore/image.c
+++ b/MagickCore/image.c
@@ -283,6 +283,8 @@
/* Set all global options that map to per-image settings */
(void) SyncImageSettings(image_info,image,exception);
+ /* At this point the image is not yet part of this image_info structure */
+ image->image_info = (MagickInfo *) NULL;
/* global options that are only set for new images */
option=GetImageOption(image_info,"delay");
@@ -3658,10 +3660,11 @@
% SyncImageSettings() syncs any image_info global options into per-image
% attributes.
%
-% Note: in IMv6 free form 'options' were always maped into 'artifacts', so
+% Note: in IMv6 free form 'options' were always mapped into 'artifacts', so
% that operations and coders can find such settings. In IMv7 if a desired
% per-image artifact is not set, then it will directly look for a global
-% option as a fallback.
+% option as a fallback, as such this copy is no longer needed, only the
+% link set up.
%
% The format of the SyncImageSettings method is:
%
@@ -3956,11 +3959,8 @@
This pointer is never explictally freed, as it is only used as a back
reference, not as the main pointer to the image_info structure. Images
- being removed from a image_info image list, should have this pointer
- reset to NULL.
-
- WARNING: when a global option is set or unset, any equivelent per-image
- artefact should also be unset.
+ being removed from a image_info image list (or yet to be added to such),
+ should have this pointer reset to NULL.
*/
/* Programming Note...
Don't do anything at this point, as image_info is only being used
diff --git a/MagickCore/property.c b/MagickCore/property.c
index 05ca1c5..be1bfa3 100644
--- a/MagickCore/property.c
+++ b/MagickCore/property.c
@@ -3203,10 +3203,10 @@
continue;
}
/* artifact - direct image artifact lookup (with glob) */
- if (LocaleNCompare("artefact:",pattern,9) == 0)
+ if (LocaleNCompare("artifact:",pattern,9) == 0)
{
if (image == (Image *) NULL)
- continue; /* else no image to retrieve artefact */
+ continue; /* else no image to retrieve artifact */
if( IfMagickTrue(IsGlob(pattern+9)) )
{
ResetImageArtifactIterator(image);
@@ -3223,7 +3223,8 @@
value=GetImageArtifact(image,pattern+9);
if (value != (char *) NULL)
AppendString2Text(value);
- /* else - no artefact of this specifc name */
+ /* else - no artifact of this specifc name */
+ continue;
}
/* FUTURE: handle %[property:...] prefix - abort other lookups */
diff --git a/MagickWand/magick-cli.c b/MagickWand/magick-cli.c
index 97dcc82..f2d1da4 100644
--- a/MagickWand/magick-cli.c
+++ b/MagickWand/magick-cli.c
@@ -61,68 +61,9 @@
/* verbose debugging,
3 - option type details
5 - include image counts
- 9 - output options/artifacts/propertys
*/
#define MagickCommandDebug 0
-#if MagickCommandDebug >= 9
-/*
- Temporary Debugging Information
- FUTURE: these should be able to be printed out using 'percent escapes'
- Actually 'Properities' can already be output with "%[*]"
-*/
-static void OutputOptions(ImageInfo *image_info)
-{
- const char
- *option,
- *value;
-
- (void) FormatLocaleFile(stderr," Global Options:\n");
- ResetImageOptionIterator(image_info);
- while ((option=GetNextImageOption(image_info)) != (const char *) NULL ) {
- (void) FormatLocaleFile(stderr," %s: ",option);
- value=GetImageOption(image_info,option);
- if (value != (const char *) NULL)
- (void) FormatLocaleFile(stderr,"%s\n",value);
- }
- ResetImageOptionIterator(image_info);
-}
-
-static void OutputArtifacts(Image *image)
-{
- const char
- *artifact,
- *value;
-
- (void) FormatLocaleFile(stderr," Image Artifacts:\n");
- ResetImageArtifactIterator(image);
- while ((artifact=GetNextImageArtifact(image)) != (const char *) NULL ) {
- (void) FormatLocaleFile(stderr," %s: ",artifact);
- value=GetImageArtifact(image,artifact);
- if (value != (const char *) NULL)
- (void) FormatLocaleFile(stderr,"%s\n",value);
- }
- ResetImageArtifactIterator(image);
-}
-
-static void OutputProperties(Image *image,ExceptionInfo *exception)
-{
- const char
- *property,
- *value;
-
- (void) FormatLocaleFile(stderr," Image Properity:\n");
- ResetImagePropertyIterator(image);
- while ((property=GetNextImageProperty(image)) != (const char *) NULL ) {
- (void) FormatLocaleFile(stderr," %s: ",property);
- value=GetImageProperty(image,property,exception);
- if (value != (const char *) NULL)
- (void) FormatLocaleFile(stderr,"%s\n",value);
- }
- ResetImagePropertyIterator(image);
-}
-#endif
-
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -308,13 +249,6 @@
fprintf(stderr, "Script Image Count = %ld\n",
GetImageListLength(cli_wand->wand.images) );
#endif
-#if MagickCommandDebug >= 9
- OutputOptions(cli_wand->wand.image_info);
- if ( cli_wand->wand.images != (Image *)NULL ) {
- OutputArtifacts(cli_wand->wand.images);
- OutputProperties(cli_wand->wand.images,cli_wand->wand.exception);
- }
-#endif
if ( IfMagickTrue(CLICatchException(cli_wand, MagickFalse)) )
break; /* exit loop */
}
@@ -530,13 +464,6 @@
fprintf(stderr, "CLI Image Count = %ld\n",
GetImageListLength(cli_wand->wand.images) );
#endif
-#if MagickCommandDebug >= 9
- OutputOptions(cli_wand->wand.image_info);
- if ( cli_wand->wand.images != (Image *)NULL ) {
- OutputArtifacts(cli_wand->wand.images);
- OutputProperties(cli_wand->wand.images,cli_wand->wand.exception);
- }
-#endif
if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse )
return(i+count);
}
diff --git a/MagickWand/operation.c b/MagickWand/operation.c
index ac9ae5d..dc1f07f 100644
--- a/MagickWand/operation.c
+++ b/MagickWand/operation.c
@@ -62,7 +62,7 @@
/*
Define declarations.
*/
-#define USE_WAND_METHODS 0
+#define USE_WAND_METHODS 1
#define MAX_STACK_DEPTH 32
#define UNDEFINED_COMPRESSION_QUALITY 0UL
@@ -1603,12 +1603,11 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% WandSimpleOperatorImages() andSimpleOperatorImagespplys one simple image operation given to all
-% the images in the CLI wand, with the settings that was previously saved in
-% the CLI wand.
+% CLISimpleOperatorImages() applys one simple image operation given to all
+% the images in the CLI wand, using any per-image or global settings that was
+% previously saved in the CLI wand.
%
-% It is assumed that any per-image settings are up-to-date with respect to
-% extra settings that were already saved in the wand.
+% It is assumed that any such settings are up-to-date.
%
% The format of the WandSimpleOperatorImages method is:
%
@@ -1626,8 +1625,8 @@
*/
/*
- Internal subrountine to apply one simple image operation to the current
- image pointed to by the CLI wand.
+ CLISimpleOperatorImage() is an Internal subrountine to apply one simple
+ image operation to the current image pointed to by the CLI wand.
The image in the list may be modified in three different ways...
* directly modified (EG: -negate, -gamma, -level, -annotate, -draw),
@@ -3120,42 +3119,6 @@
(double) QuantumRange+1.0),_exception);
break;
}
- if (LocaleCompare("set",option+1) == 0)
- {
- /* Note: arguments do not have percent escapes expanded */
- char
- *value;
-
- if (IfPlusOp) {
- if (LocaleNCompare(arg1,"registry:",9) == 0)
- (void) DeleteImageRegistry(arg1+9);
- else
- if (LocaleNCompare(arg1,"option:",7) == 0)
- {
- (void) DeleteImageOption(_image_info,arg1+7);
- (void) DeleteImageArtifact(_image,arg1+7);
- }
- else
- (void) DeleteImageProperty(_image,arg1);
- break;
- }
- value=InterpretImageProperties(_image_info,_image,arg2,_exception);
- if (value == (char *) NULL)
- CLIWandExceptionBreak(OptionWarning,"InterpretPropertyFailure",
- option);
- if (LocaleNCompare(arg1,"registry:",9) == 0)
- (void) SetImageRegistry(StringRegistryType,arg1+9,value,_exception);
- else
- if (LocaleNCompare(arg1,"option:",7) == 0)
- {
- (void) SetImageOption(_image_info,arg1+7,value);
- (void) SetImageArtifact(_image,arg1+7,value);
- }
- else
- (void) SetImageProperty(_image,arg1,value,_exception);
- value=DestroyString(value);
- break;
- }
if (LocaleCompare("shade",option+1) == 0)
{
flags=ParseGeometry(arg1,&geometry_info);
@@ -3495,9 +3458,11 @@
WandExport void CLISimpleOperatorImages(MagickCLI *cli_wand,
const char *option, const char *arg1, const char *arg2)
{
+#if !USE_WAND_METHODS
size_t
n,
i;
+#endif
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == WandSignature);
@@ -3542,7 +3507,8 @@
%
% CLIListOperatorImages() applies a single operation that is apply to the
% entire image list as a whole. The result is often a complete replacment
-% of the image list with a completely new list, or just a single image.
+% of the image list with a completely new list, or with just a single image
+% result.
%
% The format of the MogrifyImage method is:
%
@@ -4360,7 +4326,7 @@
%
% A description of each parameter follows:
%
-% o cli_wand: the main CLI Wand to use.
+% o cli_wand: the main CLI Wand to use. (sometimes not required)
%
% o option: The special option (with any switch char) to process
%
@@ -4369,7 +4335,7 @@
%
*/
WandExport void CLINoImageOperator(MagickCLI *cli_wand,
- const char *option, const char *arg1, const char *magick_unused(arg2))
+ const char *option, const char *arg1, const char *arg2)
{
#if 0
const char /* For percent escape interpretImageProperties() */
@@ -4426,11 +4392,13 @@
/*
No-op options (ignore these)
*/
- if (LocaleCompare("noop",option+1) == 0) /* no argument */
+ if (LocaleCompare("noop",option+1) == 0) /* zero argument */
break;
if (LocaleCompare("sans",option+1) == 0) /* one argument */
break;
- if (LocaleCompare("sans0",option+1) == 0) /* no argument */
+ if (LocaleCompare("sans0",option+1) == 0) /* zero argument */
+ break;
+ if (LocaleCompare("sans1",option+1) == 0) /* one argument */
break;
if (LocaleCompare("sans2",option+1) == 0) /* two arguments */
break;
@@ -4634,6 +4602,80 @@
break;
}
+ if (LocaleCompare("set",option+1) == 0)
+ {
+ /* Note: arguments are not percent escapes expanded yet */
+ /* Some settings are applied to each image in memory in turn.
+ While others only need to be applied once globally.
+ */
+ char
+ *value;
+
+ if (LocaleNCompare(arg1,"registry:",9) == 0)
+ {
+ if (IfPlusOp)
+ {
+ (void) DeleteImageRegistry(arg1+9);
+ break;
+ }
+ value=InterpretImageProperties(_image_info,_images,arg2,_exception);
+ if (value == (char *) NULL)
+ CLIWandExceptionBreak(OptionWarning,"InterpretPropertyFailure",
+ option);
+ (void) SetImageRegistry(StringRegistryType,arg1+9,value,_exception);
+ value=DestroyString(value);
+ break;
+ }
+ if (LocaleNCompare(arg1,"option:",7) == 0)
+ {
+ /* delete equivelent artifact from all images (if any) */
+ MagickResetIterator(&cli_wand->wand);
+ while ( IfMagickTrue(MagickNextImage(&cli_wand->wand)) )
+ (void) DeleteImageArtifact(_images,arg1+7);
+ MagickResetIterator(&cli_wand->wand);
+ /* now set/delete the global option as needed */
+ if (IfPlusOp) {
+ (void) DeleteImageOption(_image_info,arg1+7);
+ break;
+ }
+ value=InterpretImageProperties(_image_info,_images,arg2,_exception);
+ if (value == (char *) NULL)
+ CLIWandExceptionBreak(OptionWarning,"InterpretPropertyFailure",
+ option);
+ (void) SetImageOption(_image_info,arg1+7,value);
+ value=DestroyString(value);
+ break;
+ }
+ if ( cli_wand->wand.images == (Image *) NULL )
+ CLIWandExceptArgBreak(OptionError,"NoImagesFound",option,arg1);
+ MagickResetIterator(&cli_wand->wand);
+ while ( IfMagickTrue(MagickNextImage(&cli_wand->wand)) )
+ {
+ if (IfPlusOp) {
+ if (LocaleNCompare(arg1,"artifact:",9) == 0)
+ (void) DeleteImageArtifact(_images,arg1+9);
+ else if (LocaleNCompare(arg1,"property:",9) == 0)
+ (void) DeleteImageProperty(_images,arg1+9);
+ else
+ (void) DeleteImageProperty(_images,arg1);
+ break;
+ }
+ value=InterpretImageProperties(_image_info,_images,arg2,_exception);
+ if (value == (char *) NULL)
+ CLIWandExceptionBreak(OptionWarning,"InterpretPropertyFailure",
+ option);
+ if (LocaleNCompare(arg1,"artifact:",9) == 0)
+ (void) SetImageArtifact(_images,arg1+9,value);
+ else if (LocaleNCompare(arg1,"property:",9) == 0)
+ (void) SetImageProperty(_images,arg1+9,value,_exception);
+ else
+ (void) SetImageProperty(_images,arg1,value,_exception);
+ value=DestroyString(value);
+ break;
+ }
+ MagickResetIterator(&cli_wand->wand);
+ break;
+ }
if (LocaleCompare("clone",option+1) == 0) {
Image
*new_images;
@@ -4656,7 +4698,8 @@
/*
Informational Operations
- Note that these do not require either cli-wand or images!
+ Note that these do not require either a cli-wand or images!
+ Though currently a cli-wand much be provided regardless.
*/
if (LocaleCompare("version",option+1) == 0) {
(void) FormatLocaleFile(stdout,"Version: %s\n",
@@ -4669,7 +4712,7 @@
}
if (LocaleCompare("list",option+1) == 0) {
/*
- FUTURE: This 'switch' should really be built into the MagickCore
+ FUTURE: This 'switch' should really be part of MagickCore
*/
ssize_t
list;
diff --git a/Makefile.in b/Makefile.in
index e8027df..95e4332 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -4804,7 +4804,9 @@
tests/validate-formats-in-memory.tap \
tests/validate-formats-on-disk.tap \
tests/drawtest.tap \
- tests/wandtest.tap
+ tests/wandtest.tap \
+ tests/cli-colorspace.tap \
+ tests/cli-pipe.tap
TESTS_EXTRA_DIST = \
tests/common.shi \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 30d33fb..7196f6a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,6 +45,8 @@
tests/validate-formats-on-disk.tap \
tests/drawtest.tap \
tests/wandtest.tap
+ tests/cli-colorspace.tap \
+ tests/cli-pipe.tap \
TESTS_EXTRA_DIST = \
tests/common.shi \