# File lib/deltacloud/drivers/ec2/ec2_driver.rb, line 113
  def images(credentials, opts={} )
    ec2 = new_client(credentials)
    img_arr = []
    # if we know the image_id, we don't want to limit by owner_id, since this
    # will exclude public images
    if (opts and opts[:id])
      config = { :image_id => opts[:id] }
    else
      config = { :owner_id => "amazon" }
      config.merge!({ :owner_id => opts[:owner_id] }) if opts and opts[:owner_id]
    end
    safely do
      image_set = ec2.describe_images(config).imagesSet
      unless image_set.nil?
        image_set.item.each do |image|
          img_arr << convert_image(image)
        end
      end
    end
    img_arr = filter_on( img_arr, :architecture, opts )
    img_arr.sort_by{|e| [e.owner_id, e.name]}
  end