Index: trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java	(revision 8097)
@@ -81,10 +81,7 @@
         ImageIcon overlay;
         if(width != -1 || height != -1) {
-            /* Don't modify ImageProvider, but apply maximum size, probably cloning the ImageProvider
-               would be a better approach. */
-            overlay = image.getResource().getImageIconBounded(new Dimension(width, height));
-        } else {
-            overlay = image.get();
+            image = new ImageProvider(image).resetMaxSize(new Dimension(width, height));
         }
+        overlay = image.get();
         int x, y;
         if (width == -1 && offsetLeft < 0) {
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8097)
@@ -240,4 +240,26 @@
 
     /**
+     * Constructs a new {@code ImageProvider} from an existing one.
+     * @param image the existing image provider to be copied
+     * @since 8095
+     */
+    public ImageProvider(ImageProvider image) {
+        this.dirs = image.dirs;
+        this.id = image.id;
+        this.subdir = image.subdir;
+        this.name = image.name;
+        this.archive = image.archive;
+        this.inArchiveDir = image.inArchiveDir;
+        this.width = image.width;
+        this.height = image.height;
+        this.maxWidth = image.maxWidth;
+        this.maxHeight = image.maxHeight;
+        this.optional = image.optional;
+        this.suppressWarnings = image.suppressWarnings;
+        this.additionalClassLoaders = image.additionalClassLoaders;
+        this.overlayInfo = image.overlayInfo;
+    }
+
+    /**
      * Directories to look for the image.
      * @param dirs The directories to look for.
@@ -384,4 +406,27 @@
         this.maxWidth = maxSize.width;
         this.maxHeight = maxSize.height;
+        return this;
+    }
+
+    /**
+     * Limit the maximum size of the image.
+     *
+     * It will shrink the image if necessary, but keep the aspect ratio.
+     * The given width or height can be -1 which means this direction is not bounded.
+     *
+     * This function sets value using the most restrictive of the new or existing set of
+     * values.
+     *
+     * @param maxSize maximum image size
+     * @return the current object, for convenience
+     * @see #setMaxSize(Dimension)
+     */
+    public ImageProvider resetMaxSize(Dimension maxSize) {
+        if (this.maxWidth == -1 || maxSize.width < this.maxWidth) {
+            this.maxWidth = maxSize.width;
+        }
+        if (this.maxHeight == -1 || maxSize.height < this.maxHeight) {
+            this.maxHeight = maxSize.height;
+        }
         return this;
     }
