diff --git a/ChangeLog b/ChangeLog
index 73931ad..a5bfa60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-12 6.6.2-5 Cristy <quetzlzacatenango@image...>
+ * mogrify -format properly handles compressed image filename (e.g.
+ -format jpg logo.png.bz2).
+
2010-06-12 6.6.2-5 Anthony Thyssen <A.Thyssen@griffith...>
* Fix transprancy handling for Morphology Convolve
* Adjustments of Hit And Miss and Edge Detection kernel definitions
diff --git a/magick/utility.c b/magick/utility.c
index b39ec95..2a187c0 100644
--- a/magick/utility.c
+++ b/magick/utility.c
@@ -266,6 +266,7 @@
MagickExport void AppendImageFormat(const char *format,char *filename)
{
char
+ extension[MaxTextExtent],
root[MaxTextExtent];
assert(format != (char *) NULL);
@@ -282,6 +283,20 @@
(void) CopyMagickString(filename,message,MaxTextExtent);
return;
}
+ GetPathComponent(filename,ExtensionPath,extension);
+ if ((LocaleCompare(extension,"Z") == 0) ||
+ (LocaleCompare(extension,"bz2") == 0) ||
+ (LocaleCompare(extension,"gz") == 0) ||
+ (LocaleCompare(extension,"wmz") == 0) ||
+ (LocaleCompare(extension,"svgz") == 0))
+ {
+ GetPathComponent(filename,RootPath,root);
+ (void) CopyMagickString(filename,root,MaxTextExtent);
+ GetPathComponent(filename,RootPath,root);
+ (void) FormatMagickString(filename,MaxTextExtent,"%s.%s.%s",root,format,
+ extension);
+ return;
+ }
GetPathComponent(filename,RootPath,root);
(void) FormatMagickString(filename,MaxTextExtent,"%s.%s",root,format);
}
diff --git a/wand/mogrify.c b/wand/mogrify.c
index 6a420c7..bf8077b 100644
--- a/wand/mogrify.c
+++ b/wand/mogrify.c
@@ -4062,7 +4062,11 @@
path,*DirectorySeparator,filename);
}
if (format != (char *) NULL)
- AppendImageFormat(format,images->filename);
+ {
+ (void) CopyMagickString(images->filename,images->magick_filename,
+ MaxTextExtent);
+ AppendImageFormat(format,images->filename);
+ }
AppendImageStack(images);
FinalizeImageSettings(image_info,image,MagickFalse);
if (global_colormap != MagickFalse)