locked
Conversion d'image 24bppRgb en 8bppIndexed RRS feed

  • Question

  • Bonjour,

    Comment puis-je convertir un "jpg 24bppRgb" en un "bmp 8bppIndexed" avec la palette 256 couleurs par défaut (celle utilisée dans Microsoft Paint)?

    Merci d'avance.
    jeudi 18 juin 2009 13:39

Réponses

  • Bonjour,

    Regarde ce morceau de code, je pense que cela t'aidera.

      Public Function ImageResize(ByVal image As System.Drawing.Image, ByVal height As Int32, ByVal width As Int32) As System.Drawing.Image
            Dim g As Graphics
    
            Dim bitmap As System.Drawing.Bitmap = New System.Drawing.Bitmap(width, height, Drawing.Imaging.PixelFormat.Format8bppIndexed)
    
            Dim graphicsImage As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bitmap)
    
            graphicsImage.SmoothingMode = Drawing.Drawing2D.SmoothingMode.HighQuality
            graphicsImage.InterpolationMode = Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
    
            graphicsImage.DrawImage(image, 0, 0, bitmap.Width, bitmap.Height)
            graphicsImage.Dispose()
            Return bitmap
    
        End Function

    vendredi 19 juin 2009 07:16