dani , fagli il copia incolla che gli fai risparmiare tempoOriginariamente inviato da Daniele80
se vai sul mio forum Creazione Thumb e Compressione delle stesse
trovi le funzioni che cerchi.
codice:Public Function Ridimensiona2(ByVal path As String, ByVal myUName As String, ByVal width As Integer, ByVal high As Integer) 'Comiciamo inizializzando alcune variabili per l'anteprima: Dim objBMP As System.Drawing.Image Dim objGraphics As System.Drawing.Image 'prendiamo alcune informazioni importanti dall'immagine orginale objBMP = New Bitmap(path & myUName) Dim imgw As Integer = objBMP.Width Dim imgh As Integer = objBMP.Height 'Ora possiamo ridimensionare in scala l'immagine prendendo i valori dati in input. Questa misura è valida sia che l'immagine sia puù alta o più lunga. ' Creating a Thumbnail with scale Dim newimgw As Integer Dim newimgh As Integer If imgw > imgh Then newimgw = width newimgh = (imgh * width) / imgw ElseIf imgh > imgw Then newimgw = high newimgh = (imgh * high) / imgw Else newimgw = width newimgh = high End If 'Ora possiamo creare l'anteprima objGraphics = objBMP.GetThumbnailImage(newimgw, newimgh, Nothing, IntPtr.Zero) 'ora salviamo objGraphics.Save(path & "thumb" & myUName) End Function
cmq questa funzione te la copio al volo![]()


Rispondi quotando