【转贴】ASP给图片自动加边框生成新图片

给图片自动加边框生成新图片
引用:

<%

call Pic_bg("05.jpg","images\Img_01.jpg","images\Img_02.jpg","images\Img_03.jpg","images\Img_04.jpg","images\Img_05.jpg","images\Img_06.jpg","images\Img_07.jpg","images\Img_08.jpg","images\Img_09.jpg")


call Pic_bg("05.jpg","images\z_01.jpg","images\z_02.jpg","images\z_03.jpg","images\z_04.jpg","images\Img_05.jpg","images\z_06.jpg","images\z_07.jpg","images\z_08.jpg","images\z_09.jpg")


Public Sub Pic_bg(image_old,bg_topleft,bg_topcenter,bg_topright,bg_centerleft,bg_center,bg_centerright,bg_buttomleft,bg_buttomcenter,bg_buttomright)

'————————————设置原来画的大小『image_old』
Set Logo_old = Server.CreateObject("Persits.Jpeg")
Logo_oldPath = Server.MapPath(image_old)
Logo_old.Open Logo_oldPath
Logo_old.Width = Logo_old.OriginalWidth
Logo_old.Height = Logo_old.OriginalHeight

'————————————设置左上角的图片大小.『bg_topleft』
Set Logo_topleft = Server.CreateObject("Persits.Jpeg")
Logo_topleftPath = Server.MapPath(bg_topleft)
Logo_topleft.Open Logo_topleftPath
Logo_topleft.Width = Logo_topleft.OriginalWidth
Logo_topleft.Height = Logo_topleft.OriginalHeight

'————————————设置右上叫角图片大小。『bg_topright』
Set Logo_topright = Server.CreateObject("Persits.Jpeg")
Logo_toprightPath = Server.MapPath(bg_topright)
Logo_topright.Open Logo_toprightPath
Logo_topright.Width = Logo_topright.OriginalWidth
Logo_topright.Height = Logo_topright.OriginalHeight
'————————————设置左下叫角图片大小。『bg_buttomleft』
Set Logo_buttomleft = Server.CreateObject("Persits.Jpeg")
Logo_buttomleftPath = Server.MapPath(bg_buttomleft)
Logo_buttomleft.Open Logo_buttomleftPath
Logo_buttomleft.Width = Logo_buttomleft.OriginalWidth
Logo_buttomleft.Height = Logo_buttomleft.OriginalHeight
'————————————设置右下叫角图片大小。『bg_buttomright』
Set Logo_buttomright = Server.CreateObject("Persits.Jpeg")
Logo_buttomrightPath = Server.MapPath(bg_buttomright)
Logo_buttomright.Open Logo_buttomrightPath
Logo_buttomright.Width = Logo_buttomright.OriginalWidth
Logo_buttomright.Height = Logo_buttomright.OriginalHeight
'————————————设置背景图片大小.『bg_center』
Set Logo_center = Server.CreateObject("Persits.Jpeg")
Logo_centerPath = Server.MapPath(bg_center)
Logo_center.Open Logo_centerPath
Logo_center.Width = Logo_topleft.Width + Logo_old.Width + Logo_topright.Width '---背景图片的宽度为左上角宽+原图宽+右上角宽
Logo_center.Height =Logo_topleft.Height + Logo_old.Height + Logo_buttomleft.Height ''---背景图片的高度为左上角高+原图高+左下角高
'————————————设置上中图片的大小.『bg_topcenter』 高度不变 宽度为背景宽度
Set Logo_topcenter = Server.CreateObject("Persits.Jpeg")
Logo_topcenterPath = Server.MapPath(bg_topcenter)
Logo_topcenter.Open Logo_topcenterPath
Logo_topcenter.Width = Logo_old.Width
Logo_topcenter.Height = Logo_topcenter.OriginalHeight
'————————————设置中左图片的大小『bg_centerleft』宽度不变 高度为背景高度
Set Logo_centerleft = Server.CreateObject("Persits.Jpeg")
Logo_centerleftPath = Server.MapPath(bg_centerleft)
Logo_centerleft.Open Logo_centerleftPath
Logo_centerleft.Width = Logo_centerleft.OriginalWidth
Logo_centerleft.Height = Logo_old.Height
'————————————设置中右图片的大小『bg_centerright』 宽度不变 高度为背景高度
Set Logo_centerright = Server.CreateObject("Persits.Jpeg")
Logo_centerrightPath = Server.MapPath(bg_centerright)
Logo_centerright.Open Logo_centerrightPath
Logo_centerright.Width = Logo_centerright.OriginalWidth
Logo_centerright.Height = Logo_old.Height
'————————————设置下中图片的大小『bg_buttomcenter』 高度不变 宽度为背景宽度
Set Logo_buttomcenter = Server.CreateObject("Persits.Jpeg")
Logo_buttomcenterPath = Server.MapPath(bg_buttomcenter)
Logo_buttomcenter.Open Logo_buttomcenterPath
Logo_buttomcenter.Width = Logo_old.Width
Logo_buttomcenter.Height = Logo_buttomcenter.OriginalHeight
Dim ImagesfilesName
ImagesfilesName = (year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&Int((1000-1+1)*Rnd+1))
'===================================Start Amalgamate Chart ====================================================

'————————————层叠边框bg跟画
Logo_center.DrawImage Logo_topleft.Width ,Logo_topleft.Height, Logo_old
Logo_center.Save Server.MapPath("image/" + ImagesfilesName + ".jpg")
dim Imagespath
Imagespath=("image/" + ImagesfilesName + ".jpg")
response.Write "<img src=image/" + ImagesfilesName + ".jpg >"
'————————————层叠左上跟画
Set Logo_toplefter = Server.CreateObject("Persits.Jpeg")
Logo_toplefterPath = Server.MapPath(Imagespath)
Logo_toplefter.Open Logo_toplefterPath
Logo_toplefter.Width = Logo_toplefter.OriginalWidth
Logo_toplefter.Height = Logo_toplefter.OriginalHeight
Logo_toplefter.DrawImage 0,0, Logo_topleft
Logo_toplefter.Save Server.MapPath(Imagespath)

'————————————
Set Logo_toprighter = Server.CreateObject("Persits.Jpeg")
Logo_toprighterPath = Server.MapPath(Imagespath)
Logo_toprighter.Open Logo_toprighterPath
Logo_toprighter.Width = Logo_toprighter.OriginalWidth
Logo_toprighter.Height = Logo_toprighter.OriginalHeight
Logo_toprighter.DrawImage (Logo_topleft.Width + Logo_old.Width),0, Logo_topright
Logo_toprighter.Save Server.MapPath(Imagespath)
'————————————
Set Logo_buttomlefter = Server.CreateObject("Persits.Jpeg")
Logo_buttomlefterPath = Server.MapPath(Imagespath)
Logo_buttomlefter.Open Logo_buttomlefterPath
Logo_buttomlefter.Width = Logo_buttomlefter.OriginalWidth
Logo_buttomlefter.Height = Logo_buttomlefter.OriginalHeight
Logo_buttomlefter.DrawImage 0,(Logo_topleft.Height + Logo_old.Height), Logo_buttomleft
Logo_buttomlefter.Save Server.MapPath(Imagespath)
'———————————
Set Logo_buttomrighter = Server.CreateObject("Persits.Jpeg")
Logo_buttomrighterPath = Server.MapPath(Imagespath)
Logo_buttomrighter.Open Logo_buttomrighterPath
Logo_buttomrighter.Width = Logo_buttomrighter.OriginalWidth
Logo_buttomrighter.Height = Logo_buttomrighter.OriginalHeight
Logo_buttomrighter.DrawImage (Logo_topleft.Width + Logo_old.Width),(Logo_topleft.Height + Logo_old.Height), Logo_buttomright
Logo_buttomrighter.Save Server.MapPath(Imagespath)
'———————————
Set Logo_topcenterer = Server.CreateObject("Persits.Jpeg")
Logo_topcentererPath = Server.MapPath(Imagespath)
Logo_topcenterer.Open Logo_topcentererPath
Logo_topcenterer.Width = Logo_topcenterer.OriginalWidth
Logo_topcenterer.Height = Logo_topcenterer.OriginalHeight
Logo_topcenterer.DrawImage Logo_topleft.Width,0, Logo_topcenter
Logo_topcenterer.Save Server.MapPath(Imagespath)
'————————————设置中左图片的大小『bg_centerleft』宽度不变 高度为背景高度
Set Logo_centerlefter = Server.CreateObject("Persits.Jpeg")
Logo_centerlefterPath = Server.MapPath(Imagespath)
Logo_centerlefter.Open Logo_centerlefterPath
Logo_centerlefter.Width = Logo_centerlefter.OriginalWidth
Logo_centerlefter.Height = Logo_centerlefter.OriginalHeight
Logo_centerlefter.DrawImage 0,Logo_topleft.Height, Logo_centerleft
Logo_centerlefter.Save Server.MapPath(Imagespath)
'————————————
Set Logo_centerrighter = Server.CreateObject("Persits.Jpeg")
Logo_centerrighterPath = Server.MapPath(Imagespath)
Logo_centerrighter.Open Logo_centerrighterPath
Logo_centerrighter.Width = Logo_centerrighter.OriginalWidth
Logo_centerrighter.Height = Logo_centerrighter.OriginalHeight
Logo_centerrighter.DrawImage (Logo_topleft.Width + Logo_old.Width),Logo_topleft.Height, Logo_centerright
Logo_centerrighter.Save Server.MapPath(Imagespath)


Set Logo_buttomcenterer = Server.CreateObject("Persits.Jpeg")
Logo_buttomcentererPath = Server.MapPath(Imagespath)
Logo_buttomcenterer.Open Logo_buttomcentererPath
Logo_buttomcenterer.Width = Logo_buttomcenterer.OriginalWidth
Logo_buttomcenterer.Height = Logo_buttomcenterer.OriginalHeight
Logo_buttomcenterer.DrawImage Logo_topleft.Width,(Logo_topleft.Height + Logo_old.Height), Logo_buttomcenter
Logo_buttomcenterer.Save Server.MapPath(Imagespath)

'Set Congruence_Size = Server.CreateObject("Persits.Jpeg")
'Congruence_SizePath = Server.MapPath(Imagespath)

Set Congruence_Size = Server.CreateObject("Persits.Jpeg")
Congruence_SizePath = Server.MapPath(Imagespath)
Congruence_Size.Open Congruence_SizePath
Congruence_Size.Width = Congruence_Size.Width/2
Congruence_Size.Height = Congruence_Size.Width * Congruence_Size.OriginalHeight/ Congruence_Size.OriginalWidth
Congruence_Size.Save Server.MapPath(Imagespath)

End Sub
%>
最后编辑2006-07-04 15:45:48.077000000