diff --git a/doc/ex/preview.rb b/doc/ex/preview.rb
index <HASH>..<HASH> 100755
--- a/doc/ex/preview.rb
+++ b/doc/ex/preview.rb
@@ -3,7 +3,14 @@
 require 'RMagick'
 
 img = Magick::Image.read("images/Blonde_with_dog.jpg").first
-preview = img.preview(Magick::SolarizePreview)
+
+begin
+    preview = img.preview(Magick::SolarizePreview)
+rescue NotImplementedError
+    img = Image.read('images/notimplemented.gif').first
+    img.write('preview.jpg')
+    exit
+end
 preview.minify.write('preview.jpg')
 exit
Handle "not supported" exception when built with IM < <I>