require 'phi'
include Phi
require 'jpeg'

form = Form.new
if Phi::CLIPBOARD.has_format? Phi::CF_BITMAP
  image = Image.new form
# image.picture.load '1.jpg'
  image.picture.graphic.assign Phi::CLIPBOARD
  image.picture.save 'out.bmp'
  print "save 'out.bmp'.\n"
  jpeg = Jpeg.new
# jpeg.compression_quality = 50
  jpeg.assign image.picture.bitmap
  jpeg.save 'out.jpg'
  print "save 'out.jpg'.\n"
else
  print "clipboard have no bitmap.\n"
end
