Les Snippets

Connexion

Convertir un tableau de bytes en image

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 05/11/2007 11:30:28 et initié par Willi [Liste]
Date de mise à jour : 05/11/2007 11:32:16
Vue : 5566
Catégorie(s) : Graphique
Langages dispo pour ce code :
- C# 2.x
- VB 2005
- Delphi 5
- Delphi 5
- Voir tous les langages pour ce code snippet



Langage : Delphi 5
Date ajout : 05/07/2008
Posté par f0xi [Liste]
procedure BytesArrayToBitmap(const BytesArray: array of byte; const W, H: integer;
                             const PixelFormat: TPixelFormat; Bitmap: TBitmap);
var TBmp: TBitmap;
    pX : ^byte;
    LZ : integer;
begin
  TBmp := TBitmap.Create;
  try
    case PixelFormat of
      pf8bit : LZ := (Bitmap.Width * Bitmap.Height);
      pf16bit: LZ := (Bitmap.Width * Bitmap.Height) * 2;
      pf24bit: LZ := (Bitmap.Width * Bitmap.Height) * 3;
      pf32bit: LZ := (Bitmap.Width * Bitmap.Height) * 4;
    end;
    TBmp.PixelFormat := PixelFormat;
    TBmp.Width := W;
    TBmp.Height:= H;
    pX := TBmp.ScanLine[TBmp.Height-1];
    CopyMemory(pX, @BytesArray[0], LZ);
    Bitmap.Assign(TBmp);
  finally
    TBmp.Free;
  end;
end;

Snippets en rapport avec : Image, Convertir, Bitmap, Bytes



Codes sources en rapport avec : Image, Convertir, Bitmap, Bytes

{Visual Basic, VB6, VB.NET, VB 2005} MENU POPUP AVEC IMAGE
Placer des bitmaps 16*16 pixel dans les menus standards et popup des forms. J'ai essayé d'utilis...

{Delphi} UNITE GRAPHIQUE IMOD, AVEC EXEMPLE
Bonjour, Voici une unité graphique, reprenant la plupart des opérations et des manipulations sur ...

{Delphi} MINIMISER LES COULEURS D' UNE IMAGE VENANT DU SCANNER OU AUTRE
Dans le même esprit que ma source : http://www.delphifr.com/codes/CHANGER-COULEUR-PIXEL-PIXELS-COUL...

{Visual Basic, VB6, VB.NET, VB 2005} CONVERTIR LES IMAGESDE CD/DVD ALCOHOL 120 (.MDF), BLINDWRITE (.BXI) , DISCJUGGLER (.CDI) EN IMAGE DE CD/DVD .ISO
un petit composant ocx que je viens de coder et qui permet de convertir les images de CD/DVD Alco...

{C / C++ / C++.NET} BOITE DE DIALOGUE ANIMÉE AVEC IMAGE DE FOND
Ceci est mon premier code. Je pense que si on est resté longtemps consommateur, on peut en retour d...

{Visual Basic, VB6, VB.NET, VB 2005} OUVERTURE D'UN FICHIER BITMAP EN NATIF
Ce code permet d'ouvir un fichier Bmp. Oui, c'est sur il y a le composant Microsoft qui fait mieu...

{C# / C#.NET} IMAGES : FILTRES PAR CONVOLUTION
Voici une classe présentant un ensemble de filtres dit de convolutions (on applique une matrice à ch...

{Visual Basic, VB6, VB.NET, VB 2005} CLM'S ASCII ART
Après un bon moment sans poster, je reviens avec ce petit prog. Ce n'est pas le programme de l'an...

{C# / C#.NET} CACHER DU TEXTE DANS UNE IMAGE PAR STÉGANOGRAPHIE
Cacher du texte dans une image en C# Je suis tombé tout par hasard sur ce code en delphi crée par...

{C / C++ / C++.NET} CAPTURE DE L'IMAGE DE LA WEBCAM
Ce programme permet de visualiser dans une picturebox l'image de votre webcam, le raffrichissement n...