class Kramdown::Converter::Pdf

def render_standalone_image(el, opts)

def render_standalone_image(el, opts)
  img = el.children.first
  line = img.options[:location]
  if img.attr['src'].empty?
    warning("Rendering an image without a source is not possible#{line ? " (line #{line})" : ''}")
    return nil
  elsif img.attr['src'] !~ /\.jpe?g$|\.png$/
    warning("Cannot render images other than JPEG or PNG, got #{img.attr['src']}#{line ? " on line #{line}" : ''}")
    return nil
  end
  img_dirs = (@options[:image_directories] || ['.']).dup
  begin
    img_path = File.join(img_dirs.shift, img.attr['src'])
    image_obj, image_info = @pdf.build_image_object(open(img_path))
  rescue
    img_dirs.empty? ? raise : retry
  end
  options = {:position => :center}
  if img.attr['height'] && img.attr['height'] =~ /px$/
    options[:height] = img.attr['height'].to_i / (@options[:image_dpi] || 150.0) * 72
  elsif img.attr['width'] && img.attr['width'] =~ /px$/
    options[:width] = img.attr['width'].to_i / (@options[:image_dpi] || 150.0) * 72
  else
    options[:scale] =[(@pdf.bounds.width - mm2pt(20)) / image_info.width.to_f, 1].min
  end
  if img.attr['class'] =~ /\bright\b/
    options[:position] = :right
    @pdf.float { @pdf.embed_image(image_obj, image_info, options) }
  else
    with_block_padding(el, opts) do
      @pdf.embed_image(image_obj, image_info, options)
    end
  end
end