diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## Juicy Pixels Extra 0.5.1
+
+* `scaleBilinear` no longer hangs when the target width or height is 0.
+  [Issue 24](https://github.com/mrkkrp/JuicyPixels-extra/issues/24).
+
 ## Juicy Pixels Extra 0.5.0
 
 * Changed how edge pixels are calculated when scaling via bilinear
diff --git a/Codec/Picture/Extra.hs b/Codec/Picture/Extra.hs
--- a/Codec/Picture/Extra.hs
+++ b/Codec/Picture/Extra.hs
@@ -53,31 +53,34 @@
   Image a ->
   -- | Scaled image
   Image a
-scaleBilinear width height img@Image {..} = runST $ do
-  mimg <- M.newMutableImage width height
-  let sx, sy :: Float
-      sx = fromIntegral imageWidth / fromIntegral width
-      sy = fromIntegral imageHeight / fromIntegral height
-      go x' y'
-        | x' >= width = go 0 (y' + 1)
-        | y' >= height = M.unsafeFreezeImage mimg
-        | otherwise = do
-          let xf = fromIntegral x' * sx
-              yf = fromIntegral y' * sy
-              x, y :: Int
-              x = floor xf
-              y = floor yf
-              δx = xf - fromIntegral x
-              δy = yf - fromIntegral y
-              pixelAt' i j =
-                pixelAt img (min (pred imageWidth) i) (min (pred imageHeight) j)
-          writePixel mimg x' y' $
-            mulp (pixelAt' x y) ((1 - δx) * (1 - δy))
-              `addp` mulp (pixelAt' (x + 1) y) (δx * (1 - δy))
-              `addp` mulp (pixelAt' x (y + 1)) ((1 - δx) * δy)
-              `addp` mulp (pixelAt' (x + 1) (y + 1)) (δx * δy)
-          go (x' + 1) y'
-  go 0 0
+scaleBilinear width height img@Image {..}
+  | width <= 0 || height <= 0 =
+    generateImage (error "scaleBilinear: absurd") (max 0 width) (max 0 height)
+  | otherwise = runST $ do
+    mimg <- M.newMutableImage width height
+    let sx, sy :: Float
+        sx = fromIntegral imageWidth / fromIntegral width
+        sy = fromIntegral imageHeight / fromIntegral height
+        go x' y'
+          | x' >= width = go 0 (y' + 1)
+          | y' >= height = M.unsafeFreezeImage mimg
+          | otherwise = do
+            let xf = fromIntegral x' * sx
+                yf = fromIntegral y' * sy
+                x, y :: Int
+                x = floor xf
+                y = floor yf
+                δx = xf - fromIntegral x
+                δy = yf - fromIntegral y
+                pixelAt' i j =
+                  pixelAt img (min (pred imageWidth) i) (min (pred imageHeight) j)
+            writePixel mimg x' y' $
+              mulp (pixelAt' x y) ((1 - δx) * (1 - δy))
+                `addp` mulp (pixelAt' (x + 1) y) (δx * (1 - δy))
+                `addp` mulp (pixelAt' x (y + 1)) ((1 - δx) * δy)
+                `addp` mulp (pixelAt' (x + 1) (y + 1)) (δx * δy)
+            go (x' + 1) y'
+    go 0 0
 
 #define scaleBilinear_spec(pixel) \
 {-# SPECIALIZE scaleBilinear :: Int -> Int -> Image pixel -> Image pixel #-}
diff --git a/JuicyPixels-extra.cabal b/JuicyPixels-extra.cabal
--- a/JuicyPixels-extra.cabal
+++ b/JuicyPixels-extra.cabal
@@ -1,6 +1,6 @@
 cabal-version:   1.18
 name:            JuicyPixels-extra
-version:         0.5.0
+version:         0.5.1
 license:         BSD3
 license-file:    LICENSE.md
 maintainer:      Mark Karpov <markkarpov92@gmail.com>
diff --git a/bench/Main.hs b/bench/Main.hs
--- a/bench/Main.hs
+++ b/bench/Main.hs
@@ -9,49 +9,49 @@
   defaultMain
     [ bgroup
         "scaleBilinear"
-        [ baction "512 × 512" (scaleBilinear 512 512) "data-examples/lenna.png",
-          baction "256 × 256" (scaleBilinear 256 256) "data-examples/lenna.png",
-          baction "1024 × 1024" (scaleBilinear 1024 1024) "data-examples/lenna.png"
+        [ baction "512 × 512" (scaleBilinear 512 512) "data-examples/macaque.png",
+          baction "256 × 256" (scaleBilinear 256 256) "data-examples/macaque.png",
+          baction "1024 × 1024" (scaleBilinear 1024 1024) "data-examples/macaque.png"
         ],
       bgroup
         "crop"
-        [ baction "on 256 horizontally" (crop 256 0 256 512) "data-examples/lenna.png",
-          baction "on 265 vertically" (crop 0 256 512 256) "data-examples/lenna.png"
+        [ baction "on 256 horizontally" (crop 256 0 256 512) "data-examples/macaque.png",
+          baction "on 265 vertically" (crop 0 256 512 256) "data-examples/macaque.png"
         ],
       bgroup
         "flipHorizontally"
-        [ baction "512 × 512" flipHorizontally "data-examples/lenna.png",
-          baction "100 × 100" flipHorizontally "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 512" flipHorizontally "data-examples/macaque.png",
+          baction "100 × 100" flipHorizontally "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "flipVertically"
-        [ baction "512 × 512" flipVertically "data-examples/lenna.png",
-          baction "100 × 100" flipVertically "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 512" flipVertically "data-examples/macaque.png",
+          baction "100 × 100" flipVertically "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "rotateLeft90"
-        [ baction "512 × 512" rotateLeft90 "data-examples/lenna.png",
-          baction "100 × 100" rotateLeft90 "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 512" rotateLeft90 "data-examples/macaque.png",
+          baction "100 × 100" rotateLeft90 "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "rotateRight90"
-        [ baction "512 × 512" rotateRight90 "data-examples/lenna.png",
-          baction "100 × 100" rotateRight90 "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 512" rotateRight90 "data-examples/macaque.png",
+          baction "100 × 100" rotateRight90 "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "rotate180"
-        [ baction "512 × 512" rotate180 "data-examples/lenna.png",
-          baction "100 × 100" rotate180 "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 512" rotate180 "data-examples/macaque.png",
+          baction "100 × 100" rotate180 "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "beside"
-        [ baction "1024 × 512" beside' "data-examples/lenna.png",
-          baction "200 × 100" beside' "data-examples/lenna-scaled-down.png"
+        [ baction "1024 × 512" beside' "data-examples/macaque.png",
+          baction "200 × 100" beside' "data-examples/macaque-scaled-down.png"
         ],
       bgroup
         "below"
-        [ baction "512 × 1024" below' "data-examples/lenna.png",
-          baction "100 × 200" below' "data-examples/lenna-scaled-down.png"
+        [ baction "512 × 1024" below' "data-examples/macaque.png",
+          baction "100 × 200" below' "data-examples/macaque-scaled-down.png"
         ]
     ]
   where
diff --git a/data-examples/empty.png b/data-examples/empty.png
new file mode 100644
Binary files /dev/null and b/data-examples/empty.png differ
diff --git a/data-examples/lenna-180-rotated.png b/data-examples/lenna-180-rotated.png
deleted file mode 100644
Binary files a/data-examples/lenna-180-rotated.png and /dev/null differ
diff --git a/data-examples/lenna-below.png b/data-examples/lenna-below.png
deleted file mode 100644
Binary files a/data-examples/lenna-below.png and /dev/null differ
diff --git a/data-examples/lenna-beside.png b/data-examples/lenna-beside.png
deleted file mode 100644
Binary files a/data-examples/lenna-beside.png and /dev/null differ
diff --git a/data-examples/lenna-cropped.png b/data-examples/lenna-cropped.png
deleted file mode 100644
Binary files a/data-examples/lenna-cropped.png and /dev/null differ
diff --git a/data-examples/lenna-horizontal-flip.png b/data-examples/lenna-horizontal-flip.png
deleted file mode 100644
Binary files a/data-examples/lenna-horizontal-flip.png and /dev/null differ
diff --git a/data-examples/lenna-left-rotated.png b/data-examples/lenna-left-rotated.png
deleted file mode 100644
Binary files a/data-examples/lenna-left-rotated.png and /dev/null differ
diff --git a/data-examples/lenna-right-rotated.png b/data-examples/lenna-right-rotated.png
deleted file mode 100644
Binary files a/data-examples/lenna-right-rotated.png and /dev/null differ
diff --git a/data-examples/lenna-scaled-down.png b/data-examples/lenna-scaled-down.png
deleted file mode 100644
Binary files a/data-examples/lenna-scaled-down.png and /dev/null differ
diff --git a/data-examples/lenna-scaled-up.png b/data-examples/lenna-scaled-up.png
deleted file mode 100644
Binary files a/data-examples/lenna-scaled-up.png and /dev/null differ
diff --git a/data-examples/lenna-vertical-flip.png b/data-examples/lenna-vertical-flip.png
deleted file mode 100644
Binary files a/data-examples/lenna-vertical-flip.png and /dev/null differ
diff --git a/data-examples/lenna.png b/data-examples/lenna.png
deleted file mode 100644
Binary files a/data-examples/lenna.png and /dev/null differ
diff --git a/data-examples/macaque-180-rotated.png b/data-examples/macaque-180-rotated.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-180-rotated.png differ
diff --git a/data-examples/macaque-below.png b/data-examples/macaque-below.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-below.png differ
diff --git a/data-examples/macaque-beside.png b/data-examples/macaque-beside.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-beside.png differ
diff --git a/data-examples/macaque-cropped.png b/data-examples/macaque-cropped.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-cropped.png differ
diff --git a/data-examples/macaque-height-1.png b/data-examples/macaque-height-1.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-height-1.png differ
diff --git a/data-examples/macaque-horizontal-flip.png b/data-examples/macaque-horizontal-flip.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-horizontal-flip.png differ
diff --git a/data-examples/macaque-left-rotated.png b/data-examples/macaque-left-rotated.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-left-rotated.png differ
diff --git a/data-examples/macaque-right-rotated.png b/data-examples/macaque-right-rotated.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-right-rotated.png differ
diff --git a/data-examples/macaque-scaled-down.png b/data-examples/macaque-scaled-down.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-scaled-down.png differ
diff --git a/data-examples/macaque-scaled-up.png b/data-examples/macaque-scaled-up.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-scaled-up.png differ
diff --git a/data-examples/macaque-vertical-flip.png b/data-examples/macaque-vertical-flip.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-vertical-flip.png differ
diff --git a/data-examples/macaque-width-1.png b/data-examples/macaque-width-1.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque-width-1.png differ
diff --git a/data-examples/macaque.png b/data-examples/macaque.png
new file mode 100644
Binary files /dev/null and b/data-examples/macaque.png differ
diff --git a/tests/Codec/Picture/ExtraSpec.hs b/tests/Codec/Picture/ExtraSpec.hs
--- a/tests/Codec/Picture/ExtraSpec.hs
+++ b/tests/Codec/Picture/ExtraSpec.hs
@@ -31,20 +31,38 @@
     it "produces the same image" $
       checkWithFiles
         (scaleBilinear 512 512)
-        "data-examples/lenna.png"
-        "data-examples/lenna.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque.png"
   context "when we scale down" $
     it "produces correct image" $
       checkWithFiles
         (scaleBilinear 100 100)
-        "data-examples/lenna.png"
-        "data-examples/lenna-scaled-down.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-scaled-down.png"
   context "when we scale up" $
     it "produces correct image" $
       checkWithFiles
         (scaleBilinear 600 600)
-        "data-examples/lenna.png"
-        "data-examples/lenna-scaled-up.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-scaled-up.png"
+  context "when we scale to 1 width" $
+    it "produces correct image" $
+      checkWithFiles
+        (scaleBilinear 1 512)
+        "data-examples/macaque.png"
+        "data-examples/macaque-width-1.png"
+  context "when we scale to 1 height" $
+    it "produces correct image" $
+      checkWithFiles
+        (scaleBilinear 512 1)
+        "data-examples/macaque.png"
+        "data-examples/macaque-height-1.png"
+  context "when we scale to 0x0" $
+    it "produces the empty image" $
+      checkWithFiles
+        (scaleBilinear 0 0)
+        "data-examples/macaque.png"
+        "data-examples/empty.png"
 
 cropSpec :: Spec
 cropSpec = do
@@ -52,14 +70,14 @@
     it "produces correct image" $
       checkWithFiles
         (crop 211 210 178 191)
-        "data-examples/lenna.png"
-        "data-examples/lenna-cropped.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-cropped.png"
   context "when we pass arguments within image size (vertical)" $
     it "produces correct image" $
       checkWithFiles
         (crop 0 512 512 512)
-        "data-examples/lenna-below.png"
-        "data-examples/lenna.png"
+        "data-examples/macaque-below.png"
+        "data-examples/macaque.png"
 
 flipHorizontallySpec :: Spec
 flipHorizontallySpec =
@@ -67,8 +85,8 @@
     it "produces correct image" $
       checkWithFiles
         flipHorizontally
-        "data-examples/lenna.png"
-        "data-examples/lenna-horizontal-flip.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-horizontal-flip.png"
 
 flipVerticallySpec :: Spec
 flipVerticallySpec =
@@ -76,8 +94,8 @@
     it "produces correct image" $
       checkWithFiles
         flipVertically
-        "data-examples/lenna.png"
-        "data-examples/lenna-vertical-flip.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-vertical-flip.png"
 
 rotateLeft90Spec :: Spec
 rotateLeft90Spec =
@@ -85,8 +103,8 @@
     it "produces correct image" $
       checkWithFiles
         rotateLeft90
-        "data-examples/lenna.png"
-        "data-examples/lenna-left-rotated.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-left-rotated.png"
 
 rotateRight90Spec :: Spec
 rotateRight90Spec =
@@ -94,8 +112,8 @@
     it "produces correct image" $
       checkWithFiles
         rotateRight90
-        "data-examples/lenna.png"
-        "data-examples/lenna-right-rotated.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-right-rotated.png"
 
 rotate180Spec :: Spec
 rotate180Spec =
@@ -103,8 +121,8 @@
     it "produces correct image" $
       checkWithFiles
         rotate180
-        "data-examples/lenna.png"
-        "data-examples/lenna-180-rotated.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-180-rotated.png"
 
 besideSpec :: Spec
 besideSpec =
@@ -112,8 +130,8 @@
     it "produces correct image" $
       checkWithFiles
         (\x -> beside [x, x])
-        "data-examples/lenna.png"
-        "data-examples/lenna-beside.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-beside.png"
 
 belowSpec :: Spec
 belowSpec =
@@ -121,8 +139,8 @@
     it "produces correct image" $
       checkWithFiles
         (\x -> below [x, x])
-        "data-examples/lenna.png"
-        "data-examples/lenna-below.png"
+        "data-examples/macaque.png"
+        "data-examples/macaque-below.png"
 
 -- | Run a transforming on the image loaded from a file and compare the
 -- resulting image with the contents of another file.
