当前位置:编程学习 > asp >>

asp aspjpeg将多个图片合成gif动画

<% 
'功能:利用asp教程jpeg将多个图片合成gif动画教程
'    并给此gif动画加水印
'参数:
' str:图片相对地址,多个图片中间使用英文逗号隔开

Function creategif(str)
'多图动画输出 
Dim Jpeg,Gif 
Set Jpeg = Server.CreateObject("Persits.Jpeg") 
    Set Gif = Jpeg.Gif 
 FileNames=Split(str,",")       
        Gif.Width = 100 
        Gif.Height = 100 
        For i = 0 To UBound(FileNames) 
            Jpeg.Open Server.MapPath(FileNames(i)) 
            Jpeg.PreserveAspectRatio = True 
            if Jpeg.OriginalWidth > 100 or Jpeg.OriginalHeight > 100 Then 
                if Jpeg.OriginalWidth > Jpeg.OriginalHeight Then 
                    Jpeg.Width = 100 
                Else 
                    Jpeg.Height = 100 
                End If 
            End If 
            Gif.AddImage Jpeg, (100 - Jpeg.Width) / 2, (100 - Jpeg.Height) / 2 
            Gif.DisposalMethod =2
   
   Gif.PenColor = 235
   Gif.FontFamily = "Tahoma" 
   Gif.FontSize = 13
   Gif.PrintText 20,10, .net教程">www.zzzyk.com 
  Next 
        Gif.SendBinary  '在浏览器中输出此图片
  'Gif.Save Server.MapPath("1.gif") '保存为1.gif图片
    Set Gif=Nothing 
Set Jpeg=Nothing 
End Function

Call creategif("images/1.jpg,images/2.jpg,images/3.jpg,images/4.jpg")
%>

补充:asp教程,高级应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,