def self.showimg(len,imgname,content)
cur = 10
canvas = Magick::ImageList.new
#granite=Magick::ImageList.new.from_blob(imgname)
#granite=granite.frame(width=20, height=20, x=20, y=20, inner_bevel=3, outer_bevel=1, color='gray75')
#granite=granite.border(5, 5, 'red')
granitet = Magick::ImageList.new.new_image(500,380)do
self.background_color = 'gray'
end
granite =Magick::ImageList.new.from_blob(imgname)
img_y=granite.rows
img_x=granite.columns
points=[1,8]
temp=1
while temp<=10
points<
points<
temp+=1
end
temp=1
while temp<=18
points<
points<
temp+=1
end
temp=1
while temp<=10
points<
points<
temp+=1
end
temp=1
while temp<=18
points<
points<
temp+=1
end
pr = Magick::Draw.new
pr.define_clip_path('example') {
pr.polygon(*points)
}
pr.clip_path('example')
tf=Magick::ImageList.new("public/images/model1/jitian.gif")
granite = granite.composite(tf,rand(200),rand(200), Magick::OverCompositeOp)
cols = rows = nil
granite.change_geometry("350") do |c,r|
pr.composite(0,0, c, r, granite)
cols = c
rows = r
end
text = Magick::Draw.new
canvas.new_image(800,680) do
self.background_color = 'gray'
end
pr.draw(granitet)
canvas = canvas.composite(granitet,220,220, Magick::InCompositeOp)
#canvas=canvas.border(5, 5, 'red')
#text=text.stroke_opacity(0.1)
#text=text.opacity(0.1)
#text=text.fill_opacity(0.1)
#tft=Magick::ImageList.new
text.annotate(canvas,0,0,10,10,CGI.unescape(content)) do
self.rotation=0
#self.encoding='gbk'
self.pointsize = 20
self.font_weight = Magick::BoldWeight
self.fill = 'white'
self.gravity = Magick::SouthEastGravity
end
@myimage = canvas.to_blob{self.format="jpg"}
end