--- a
+++ b/iipzoom/openzoom_patch
@@ -0,0 +1,109 @@
+diff --git a/src/org/openzoom/flash/descriptors/iip/IIPImageDescriptor.as b/src/org/openzoom/flash/descriptors/iip/IIPImageDescriptor.as
+index 56f5342..edf4d7e 100644
+--- a/src/org/openzoom/flash/descriptors/iip/IIPImageDescriptor.as
++++ b/src/org/openzoom/flash/descriptors/iip/IIPImageDescriptor.as
+@@ -73,6 +73,8 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+     private static const DEFAULT_TILE_HEIGHT:uint = 256
+     private static const DEFAULT_SERVER:String = "/fcgi-bin/iipsrv.fcgi"
+ 
++    private var resolutions:uint
++
+ 
+     //--------------------------------------------------------------------------
+     //
+@@ -88,11 +90,11 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+     public function IIPImageDescriptor(source:String,
+                                        width:uint,
+                                        height:uint,
+-                                       tileWidth:uint=256,
+-                                       tileHeight:uint=256)
++                                       tileWidth:uint,
++                                       tileHeight:uint,
++				       numLevels:uint)
+     {
+         // path to server & image, e.g
+-        // http://merovingio.c2rmf.cnrs.fr/fcgi-bin/iipsrv.fcgi?FIF=/home/eros/iipimage/cop31/cop31_pyr_000_090.tif
+         // http://merovingio.c2rmf.cnrs.fr/fcgi-bin/iipsrv.fcgi?FIF=/home/eros/iipimage/Tuberculous.tif
+         this.source = source
+ 
+@@ -105,7 +107,7 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+ 
+         _type = DEFAULT_TYPE
+ 
+-        _numLevels = getNumLevels(width, height, tileWidth, tileHeight)
++	_numLevels = numLevels
+         createLevels(width, height, tileWidth, tileHeight, numLevels)
+     }
+ 
+@@ -156,7 +158,16 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+ 	if(matches==null) return null
+ 	if(matches.length>=4){
+ 		tileWidth = Number(matches[2])
+-		tileHeight = Number(matches[3]);
++		tileHeight = Number(matches[3])
++	}
++	else return null
++
++	// Resolution-number
++	var resolutions:uint
++	matches = metadata.match(/.*(Resolution-number:)([0-9\.]+)/)
++	if(matches==null) return null
++	if(matches.length>=1){
++		resolutions = Number(matches[2])
+ 	}
+ 	else return null
+ 
+@@ -166,7 +177,8 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+                                       width,
+                                       height,
+                                       tileWidth,
+-                                      tileHeight)
++                                      tileHeight,
++				      resolutions)
+ 
+ 
+     }
+@@ -196,7 +208,7 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+     {
+         var log2:Number = Math.log(Math.max(width / tileWidth, height / tileHeight)) / Math.LN2
+         var maxLevel:uint = numLevels - 1
+-        var index:int = clamp(Math.ceil(log2) + 1, 0, maxLevel)
++        var index:int = clamp(Math.floor(log2) + 1, 0, maxLevel)
+         var level:IImagePyramidLevel = getLevelAt(index)
+ 
+         // FIXME
+@@ -211,7 +223,7 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+      */
+     public function clone():IImagePyramidDescriptor
+     {
+-        return new IIPImageDescriptor(source, width, height, tileWidth, tileHeight)
++        return new IIPImageDescriptor(source, width, height, tileWidth, tileHeight, numLevels)
+     }
+ 
+     //--------------------------------------------------------------------------
+@@ -233,14 +245,6 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+     //  Methods: Internal
+     //
+     //--------------------------------------------------------------------------
+-    /**
+-     * @private
+-     */
+-    private function getNumLevels(width:uint, height:uint, tileWidth:uint, tileHeight:uint):uint
+-    {
+-        // How many levels until image fits into a single tile
+-        return Math.ceil(Math.log(Math.ceil(Math.max(width / tileWidth, height / tileHeight)))/Math.LN2) + 1
+-    }
+ 
+ 
+     /**
+@@ -285,8 +289,8 @@ public class IIPImageDescriptor extends ImagePyramidDescriptorBase
+     {
+         var size:Point = new Point()
+         var scale:Number = getScale(level)
+-        size.x = Math.ceil(width * scale)
+-        size.y = Math.ceil(height * scale)
++        size.x = Math.floor(width * scale)
++        size.y = Math.floor(height * scale)
+ 
+         return size
+     }