diff -ur TclMagick-0.45-old/doc/TclMagick.html TclMagick-0.45-new/doc/TclMagick.html
--- TclMagick-0.45-old/doc/TclMagick.html	Sat Mar 13 23:50:55 2004
+++ TclMagick-0.45-new/doc/TclMagick.html	Tue Sep 12 13:45:33 2006
@@ -1183,6 +1183,25 @@
 	</tr>
 	<tr>
 	  <td><div align="left"></div>
+	    <div align="left">wandName compressionquality ?quality?<br>
+	      wandName GetCompressionQuality <br>
+		  wandName SetCompressionQuality quality<br>
+	    </div></td>
+	  <td><div align="left"> MagickGet/SetImageCompressionQuality<br>
+	      MagickGetImageCompressionQuality<br>
+		  MagickSetImageCompressionQuality<br>
+	    </div></td>
+	</tr>
+	<tr>
+	  <td><div align="left">
+	      <ul>
+		<li>int quality (1 - 100)</li>
+	      </ul>
+	    </div></td>
+	  <td><div align="left">MagickGet/SetImageCompressionQuality are not impremented in GraphicsMagick1.1.7/1.2.0. These Tcl API are wrapper for ImageMagick6.x or emulation of ImageMagick API if TclMagick was compiled with GraphicsMagick.</div></td>
+	</tr>
+	<tr>
+	  <td><div align="left"></div>
 	    <div align="left">wandName delay ?delay? <br>
 	      wandName GetDelay <br>
 	      wandName SetDelay delay <br>
@@ -1257,20 +1276,22 @@
 	</tr>
 	<tr>
 	  <td><div align="left"></div>
-	    <div align="left">wandName format <br>
+	    <div align="left">wandName format ?format?<br>
 	      wandName GetFormat <br>
+	      wandName SetFormat format<br>
 	    </div></td>
-	  <td><div align="left">MagickGetImageFormat<br>
+	  <td><div align="left">MagickGet/SetImageFormat<br>
 	      MagickGetImageFormat<br>
+	      MagickSetImageFormat<br>
 	    </div></td>
 	</tr>
 	<tr>
 	  <td><div align="left">
 	      <ul>
-		<li>returns string format</li>
+		<li>string format</li>
 	      </ul>
 	    </div></td>
-	  <td><div align="left"></div></td>
+	  <td><div align="left">MagickSetImageFormat is not impremented in GraphicsMagick1.1.7/1.2.0. This Tcl API is wrapper for ImageMagick6.x or emulation of ImageMagick API if TclMagick was compiled with GraphicsMagick.</div></td>
 	</tr>
 	<tr>
 	  <td><div align="left"></div>
Only in TclMagick-0.45-new/doc: TclMagick.html~
diff -ur TclMagick-0.45-old/generic/TclMagick.c TclMagick-0.45-new/generic/TclMagick.c
--- TclMagick-0.45-old/generic/TclMagick.c	Sun Jan 23 06:38:52 2005
+++ TclMagick-0.45-new/generic/TclMagick.c	Tue Sep 12 20:41:22 2006
@@ -25,8 +25,56 @@
 
 /* Debug TclMagick */
 #define MAGICK_DEBUG
-/**********************************************************************/
 
+/*----------------------------------------------------------------------
+ * UnImpremented Functions in GraphicsMagick
+ *----------------------------------------------------------------------
+ */
+#ifdef TCLMAGICK_USE_GM
+unsigned int MagickSetImageCompressionQuality(MagickWand *wand,
+ const unsigned long quality)
+{
+    assert(wand != (MagickWand *) NULL);
+    assert(wand->signature == MagickSignature);
+    if (wand->images == (Image *) NULL) {
+        ThrowWandException(WandError,WandContainsNoImages,wand->id);
+    }
+    wand->image_info->quality = quality;
+    return (True);
+}
+unsigned long MagickGetImageCompressionQuality(MagickWand *wand)
+{
+    assert(wand != (MagickWand *) NULL);
+    assert(wand->signature == MagickSignature);
+    if (wand->images == (Image *) NULL) {
+        ThrowWandException(WandError,WandContainsNoImages,wand->id);
+    }
+    return wand->image_info->quality;
+}
+unsigned int MagickSetImageFormat(MagickWand *wand, const char *format)
+{
+    MagickInfo *magick_info;
+
+    assert(wand != (MagickWand *) NULL);
+    assert(wand->signature == MagickSignature);
+    if (wand->images == (Image *) NULL) {
+        ThrowWandException(WandError,WandContainsNoImages,wand->id);
+    }
+    if (format == (char*)NULL || *format == '\0') {
+        *wand->image->magick = '\0';
+        return (True);
+    }
+    magick_info = GetMagickInfo(format, &wand->exception);
+    if (magick_info == (MagickInfo *) NULL) {
+        return (False);
+    }
+    DestroyExceptionInfo(&wand->exception);
+    CopyMagickString(wand->image->magick, format, MaxTextExtent);
+    return (True);
+}
+#endif
+
+/**********************************************************************/
 struct {
     int             initialized; /* Whether module has been initialized */
     Tcl_HashTable   hashTable;   /* HasTable for MagickWand objects */
@@ -46,17 +94,19 @@
  */
 int myMagickError(Tcl_Interp  *interp, MagickWand *wandPtr )
 {
+	Tcl_DString ds;
     char *description;
 
     ExceptionType severity;
     char msg[40];
+    Tcl_DStringInit(&ds);
 
     description = MagickGetException(wandPtr, &severity);
     if( (description == NULL) || (strlen(description) == 0) ) {
         Tcl_AppendResult(interp, MagickGetPackageName(), ": Unknown error", NULL);
     } else {
         sprintf(msg, "%s: #%d:", MagickGetPackageName(), severity);
-        Tcl_AppendResult(interp, description, NULL);
+        Tcl_AppendResult(interp, Tcl_ExternalToUtfDString(NULL, description, -1, &ds), NULL);
     }
     if( description != NULL ) {
         MagickRelinquishMemory(description);
@@ -65,6 +115,7 @@
      * if(severity < ErrorException) --> warning
      * return TCL_OK ???
      */
+    Tcl_DStringFree(&ds);
     return TCL_ERROR;
 }
 
@@ -502,11 +553,14 @@
 
 	fonts = MagickQueryFonts(pattern, &listLen);
 	if( (fonts != NULL) && (listLen > 0) ) {
+            Tcl_DString fontName;
             listPtr = Tcl_NewListObj(0, NULL);
 	    for( i=0; i < listLen; i++ ) {
+	        Tcl_ExternalToUtfDString(NULL, fonts[i], -1, &fontName);
                 Tcl_ListObjAppendElement(interp, listPtr,
-					 Tcl_NewStringObj(fonts[i], (int)strlen(fonts[i])) );
+					 Tcl_NewStringObj(Tcl_DStringValue(&fontName), -1) );
             }
+            Tcl_DStringFree(&fontName);
     	    Tcl_SetObjResult(interp, listPtr);
         }
 	if (fonts != NULL)
@@ -741,11 +795,12 @@
         "colorspace",       "GetColorspace",        "SetColorspace",
         "compose",          "GetCompose",           "SetCompose",
         "compression",      "GetCompression",       "SetCompression",
+        "compressionquality","GetCompressionQuality","SetCompressionQuality",
         "delay",            "GetDelay",             "SetDelay",
         "depth",            "GetDepth",             "SetDepth",
         "dispose",          "GetDispose",           "SetDispose",
         "extrema",          "GetExtrema",
-        "format",           "GetFormat",
+        "format",           "GetFormat",            "SetFormat",
         "getimage",         "GetImage",
         "imagefilename",    "GetImageFilename",     "SetImageFilename",
         "gamma",            "GetGamma",             "SetGamma",
@@ -893,11 +948,12 @@
         TM_COLORSPACE,      TM_GET_COLORSPACE,          TM_SET_COLORSPACE,
         TM_COMPOSE,         TM_GET_COMPOSE,             TM_SET_COMPOSE,
         TM_COMPRESSION,     TM_GET_COMPRESSION,         TM_SET_COMPRESSION,
+        TM_COMPRESSIONQUALITY,TM_GET_COMPRESSIONQUALITY,TM_SET_COMPRESSIONQUALITY,
         TM_DELAY,           TM_GET_DELAY,               TM_SET_DELAY,
         TM_DEPTH,           TM_GET_DEPTH,               TM_SET_DEPTH,
         TM_DISPOSE,         TM_GET_DISPOSE,             TM_SET_DISPOSE,
         TM_EXTREMA,         TM_GET_EXTREMA,
-        TM_FORMAT,          TM_GET_FORMAT,
+        TM_FORMAT,          TM_GET_FORMAT,              TM_SET_FORMAT,
         TM_GETIMAGE,        TM_GET_IMAGE,
         TM_IMAGE_FILENAME,  TM_GET_IMAGE_FILENAME,      TM_SET_IMAGE_FILENAME,
         TM_GAMMA,           TM_GET_GAMMA,               TM_SET_GAMMA,
@@ -2674,6 +2730,45 @@
 	break;
     }
 
+    case TM_COMPRESSIONQUALITY:      /* compressionquality ?quality? */
+    case TM_GET_COMPRESSIONQUALITY:  /* GetCompressionQuality */
+    case TM_SET_COMPRESSIONQUALITY:  /* SetCompressionQuality quality */
+    {
+        unsigned long quality;
+
+	if( ((enum subIndex)index == TM_COMPRESSIONQUALITY) && (objc > 3) ) {
+	    Tcl_WrongNumArgs(interp, 2, objv, "?quality?");
+	    return TCL_ERROR;
+	}
+	if( ((enum subIndex)index == TM_GET_COMPRESSIONQUALITY) && (objc != 2) ) {
+	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
+	    return TCL_ERROR;
+	}
+	if( ((enum subIndex)index == TM_SET_COMPRESSIONQUALITY) && (objc != 3) ) {
+	    Tcl_WrongNumArgs(interp, 2, objv, "quality");
+	    return TCL_ERROR;
+	}
+	if (objc == 3) {
+	    /*
+	     * Set quality
+	     */
+	    if (Tcl_GetLongFromObj(interp, objv[2], &quality) != TCL_OK) {
+	        return TCL_ERROR;
+	    }
+	    result = MagickSetImageCompressionQuality(wandPtr, quality);
+	    if (!result) {
+		return myMagickError(interp, wandPtr);
+	    }
+	} else {
+	    /*
+	     * Get quality
+	     */
+	    quality = MagickGetImageCompressionQuality(wandPtr);
+	    Tcl_SetObjResult(interp, Tcl_NewLongObj((long)quality));
+	}
+	break;
+    }
+
     case TM_DELAY:      /* delay ?delay? */
     case TM_GET_DELAY:  /* GetDelay */
     case TM_SET_DELAY:  /* SetDelay delay */
@@ -2821,19 +2916,42 @@
         break;
     }
 
-    case TM_FORMAT:     /* format */
+    case TM_FORMAT:     /* format ?format? */
     case TM_GET_FORMAT: /* GetImageFormat */
+    case TM_SET_FORMAT: /* SetImageFormat format*/
     {
 	char *fmt;
 
-	if( objc != 2 ) {
+	if( ((enum subIndex)index == TM_FORMAT) && (objc > 3) ) {
+	    Tcl_WrongNumArgs(interp, 2, objv, "?format?");
+	    return TCL_ERROR;
+	}
+	if( ((enum subIndex)index == TM_GET_FORMAT) && (objc != 2) ) {
 	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
 	    return TCL_ERROR;
 	}
-	fmt = (char *)MagickGetImageFormat(wandPtr);
-	if(fmt != NULL) {
-	    Tcl_SetResult(interp, fmt, TCL_VOLATILE);
-	    MagickRelinquishMemory(fmt); /* Free TclMagick resource */
+	if( ((enum subIndex)index == TM_SET_FORMAT) && (objc != 3) ) {
+	    Tcl_WrongNumArgs(interp, 2, objv, "format");
+	    return TCL_ERROR;
+	}
+	if (objc == 3) {
+	    /*
+	     * Set format
+	     */
+	    fmt = Tcl_GetString(objv[2]);
+	    result = MagickSetImageFormat(wandPtr, fmt);
+	    if (!result) {
+		return myMagickError(interp, wandPtr);
+	    }
+	} else {
+	    /*
+	     * Get format
+	     */
+	    fmt = (char *)MagickGetImageFormat(wandPtr);
+	    if(fmt != NULL) {
+		Tcl_SetResult(interp, fmt, TCL_VOLATILE);
+		MagickRelinquishMemory(fmt); /* Free TclMagick resource */
+	    }
 	}
 	break;
     }
@@ -4398,14 +4516,16 @@
     case TM_PING:          /* ping filename */
     case TM_PING_IMAGE:    /* PingImage filename */
     {
+	Tcl_DString ds;
 	char *filename;
 
 	if (objc != 3) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "filename");
 	    return TCL_ERROR;
 	}
-	filename = Tcl_GetString(objv[2]);
+	filename = Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[2]), -1, &ds);
 	result = MagickPingImage(wandPtr, filename);
+	Tcl_DStringFree(&ds);
 	if (!result) {
 	    return myMagickError(interp, wandPtr);
 	}
@@ -6688,14 +6808,16 @@
     case TM_FILLPATTERNURL:      /* fillpatternurl url */
     case TM_SET_FILLPATTERNURL:  /* SetFillPatternURL url */
     {
+	Tcl_DString ds;
 	char *url;
 
 	if( objc != 3 ) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "url");
 	    return TCL_ERROR;
 	}
-	url = Tcl_GetString(objv[2]);
+	url = Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[2]), -1, &ds);
 	DrawSetFillPatternURL(wandPtr, url);
+	Tcl_DStringFree(&ds);
 	break;
     }
 
@@ -6738,6 +6860,7 @@
     case TM_GET_FONT:    /* GetFont */
     case TM_SET_FONT:    /* SetFont fontname */
     {
+        Tcl_DString ds;
 	char *fontname;
 
 	if( ((enum subIndex)index == TM_FONT) && (objc > 3) ) {
@@ -6750,16 +6873,18 @@
 	    Tcl_WrongNumArgs(interp, 2, objv, "fontname");
 	    return TCL_ERROR;
 	}
+	Tcl_DStringInit(&ds);
 	if (objc == 3) { /* Set font */
-	    fontname = Tcl_GetString(objv[2]);
+	    fontname = Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[2]), -1, &ds);
 	    DrawSetFont(wandPtr, fontname);
 	} else {    /* Get font */
-	    fontname = DrawGetFont(wandPtr);
+	    fontname = Tcl_ExternalToUtfDString(NULL, DrawGetFont(wandPtr), -1, &ds);
 	    if(fontname != NULL) {
 		Tcl_SetResult(interp, fontname, TCL_VOLATILE);
 		MagickRelinquishMemory(fontname); /* Free TclMagick resource */
 	    }
 	}
+	Tcl_DStringFree(&ds);
 	break;
     }
 
@@ -6767,6 +6892,7 @@
     case TM_GET_FONTFAMILY:    /* GetFontFamily */
     case TM_SET_FONTFAMILY:    /* SetFontFamily name */
     {
+        Tcl_DString ds;
 	char *name;
 
 	if( ((enum subIndex)index == TM_FONTFAMILY) && (objc > 3) ) {
@@ -6779,16 +6905,19 @@
 	    Tcl_WrongNumArgs(interp, 2, objv, "name");
 	    return TCL_ERROR;
 	}
+	Tcl_DStringInit(&ds);
 	if (objc == 3) { /* Set font family */
-	    name = Tcl_GetString(objv[2]);
+	    name = Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[2]), -1, &ds);
 	    DrawSetFontFamily(wandPtr, name);
 	} else {    /* Get font family */
 	    name = DrawGetFontFamily(wandPtr);
 	    if(name != NULL) {
-		Tcl_SetResult(interp, name, TCL_VOLATILE);
+		Tcl_ExternalToUtfDString(NULL, name, -1, &ds);
+		Tcl_SetResult(interp, Tcl_DStringValue(&ds), TCL_VOLATILE);
 		MagickRelinquishMemory(name); /* Free TclMagick resource */
 	    }
 	}
+	Tcl_DStringFree(&ds);
 	break;
     }
 
diff -ur TclMagick-0.45-old/generic/TclMagick.h TclMagick-0.45-new/generic/TclMagick.h
--- TclMagick-0.45-old/generic/TclMagick.h	Wed Jan 12 01:33:15 2005
+++ TclMagick-0.45-new/generic/TclMagick.h	Tue Sep 12 12:25:40 2006
@@ -8,8 +8,49 @@
 
 #include <tcl.h>
 #include <wand/magick_wand.h>
+#define DEBUG 0
+
+#if MagickLibVersion < 0x010000
+#define TCLMAGICK_USE_IM
+#else
+#define TCLMAGICK_USE_GM
+#include <assert.h>
+
+#define WandContainsNoImages "Wand contains no images"
+#define True  1
+#define False 0
+#define ThrowWandException(code,reason,description) \
+{ \
+  ThrowException(&wand->exception,code,reason,description); \
+  return(False); \
+}
+
+struct _MagickWand
+{
+  char
+    id[MaxTextExtent];
+
+  ExceptionInfo
+    exception;
+
+  ImageInfo
+    *image_info;
+
+  QuantizeInfo
+    *quantize_info;
+
+  Image
+    *image,
+    *images;
+
+  unsigned int
+    iterator;
+
+  unsigned long
+    signature;
+};
+#endif
 
-#define DEBUG 1
 
 static CONST char *objTypeNames[] = {
     "wand", "drawing", "pixel", (char *) NULL
