diff --git a/lib/cucumber/formatter/html.rb b/lib/cucumber/formatter/html.rb
index a478c1c331..6439e3d006 100644
--- a/lib/cucumber/formatter/html.rb
+++ b/lib/cucumber/formatter/html.rb
@@ -2,6 +2,7 @@
require 'builder'
require 'cucumber/formatter/duration'
require 'cucumber/formatter/io'
+require 'pathname'
module Cucumber
module Formatter
@@ -43,6 +44,9 @@ def embed(src, mime_type, label)
def embed_image(src, label)
id = "img_#{@img_id}"
@img_id += 1
+ if @io.respond_to?(:absolute_path) and File.exist?(src)
+ src = Pathname.new(File.absolute_path(src)).relative_path_from(@io.absolute_path)
+ end
@builder.span(:class => 'embed') do |pre|
pre << %{#{label}
}