1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Imports Microsoft.VisualBasic
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
Imports System.IO
Namespace ProjetY
Public Class TraitementImage
Public Shared Sub AjoutFiligrane(ByRef img As Image)
Dim Width, Height, shadowSize As Integer
Dim Bitmap As System.Drawing.Bitmap
Dim ImgFormat As ImageFormat
Dim baseMap As Bitmap
Dim top, left As Integer
Dim letterBrush As SolidBrush = New SolidBrush(Color.FromArgb(50, 255, 255, 255))
Dim shadowBrush As SolidBrush = New SolidBrush(Color.FromArgb(50, 0, 0, 0))
Dim fontTitle As Font = New Font("tahoma", 20, FontStyle.Bold)
ImgFormat = ImageFormat.Jpeg : HttpContext.Current.Response.ContentType = "image/jpeg" ' Default=jpeg '
Width = img.Width
Height = img.Height
baseMap = New Bitmap(Width, Height)
Dim myGraphic As Graphics = Graphics.FromImage(baseMap)
With myGraphic
.DrawImage(img, 0, 0, Width, Height)
.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
.DrawString("LABS.INSERT-TITLE.COM", fontTitle, shadowBrush, 5, 60)
.DrawString("LABS.INSERT-TITLE.COM", fontTitle, letterBrush, 7, 62)
End With
'img.Dispose()
End Sub
End Class
End Namespace |
Partager