 (defn insert! [^BufferedImage a
 	       ^BufferedImage b
 	       dx dy]
-  "Insert image a into image b at coordinates dx,dy."
+  "Insert image a into image b at coordinates dx dy."
   (let [da (.getRaster a)
 	db (.getRaster b)]
     (reduce = nil

  (.getSubimage b x y dx dy))

(defn get-samples [^BufferedImage b]
  "Get a flat list of all samples in an image."
  (let [d (.getData b)]
    (for [x (range (.getWidth d))
	  y (range (.getHeight d))

  (import com.mortennobel.imagescaling.ResampleOp))

(defn load-image [^String f]
  "Load filename f into a BufferedImage"
  (ImageIO/read
   (File. f)))

(defn save-image [^BufferedImage b ^String f]
  "Save image b to filename f."
  (ImageIO/write b "jpg" (File. f)))

(defn rescale [x y ^BufferedImage b]
  "Rescale image b to dimensions x y."
  (. (ResampleOp. x y) (filter b nil)))

(defn rescale-fixed-ratio [x ^BufferedImage b]
  "Resize image b to width x, keeping the aspect ratio."
  (let [h (.getHeight b)
	r (/ x (.getWidth b))
	y (int (* h r))]
