coo-per
Messages postés67Date d'inscriptionsamedi 12 janvier 2008StatutMembreDernière intervention30 mars 2014
-
11 sept. 2012 à 20:33
Bonjour tout le monde
je développe une application vb.net et je veux sauvegarder une image dans un répertoire ,je me trouve avec l'erreur suivant : Une erreur générique s'est produite dans GDI+.
dans le module j'ai déclaré la procédure suivante
Public chemin_etudiant As String = "D:\ETUDIANTS\"
Public Sub aap_image(ByVal A As PictureBox, ByVal B As String, ByVal repertoire As String)
Dim bm As New Bitmap(A.Image)
Dim x As Int32 = 125 'variable for new width size
Dim y As Int32 = 150 'variable for new height size
Dim width As Integer = Val(x) 'image width.
Dim height As Integer = Val(y) 'image height
Dim thumb As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(thumb)
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(bm, New Rectangle(0, 0, width, height), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
g.Dispose()
'image path. better to make this dynamic. I am hardcoding a path just for example sake
thumb.Save(repertoire & B, System.Drawing.Imaging.ImageFormat.Jpeg) 'can use any image format bm.Dispose()
thumb.Dispose()
End Sub
et dans le bouton je fais l'appel a cette procédure