Chinese (People's Republic of China)  English  Français


Supinfo-Projects.com
Tous les projets des élèves ingénieurs de Supinfo



Projets
  Dernier Projet
  Les plus populaires
  Tous les Projets

279 Visiteurs
3168 Projets


My Supinfo-Projects

   Connectez-vous
   Créez un Compte


Synopsis

   353 Visites
   Note INTERNET : 16
    (5 Votants)
   0 Commentaires

   Lire l'article

Evaluez cet article

20
18
16
14
12
10
8
6
4
2
0


Commentez cet article

Auteur :

Email :

Votre commentaire :



 
2004 - Pérennisation
ASP.Net GDI+
[40 mn de lecture - paru le 5/8/2004 1:54:12 PM - Public : Confirmé]

Auteur

degrem_mMichel DEGREMONT
Elève-Ingénieur Supinfo Paris
Promotion SUPINFO 2006

   Lui écrire
   Tous les projets de cet auteur
   Le mini-CV de cet auteur

6. Modification by Pixels

Let us go always further in the handling of the images.

6.1. Resolutions

GDI+ also enables you to modify the resolution of an image. You must use the SetResolution method which takes in parameter the vertical resolution and the horizontal resolution

/// <summary>
/// change resolution of image
/// </summary>

public void resolution(float nouvelleResolution)
{
// creation of an image to the same dimension that the image source
    Bitmap tempImage = new Bitmap(monImage);
    int W=tempImage.Width, H=tempImage.Height;
// one course the image pixel by pixel to modify each one of them
    for (int li=0; li<H; li++)
    for (int col=0; col<W; col++)
    {
         tempImage.SetResolution(nouvelleResolution,nouvelleResolution);
    }
    monImage.Dispose();
    monImage = tempImage;
}

6.2. Transparency

We will put a filter or rather an image, here a rectangle yellow and given to him a tiny opacity.

/// <summary>
/// filter transparent
/// </summary>

public void transparence(string chemin)
{
    // one creates the image since an existing image
    Bitmap curImage = new Bitmap(monImage);
    Graphics g =Graphics.FromImage(curImage);
    // // the image is drawn
    g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height);
    // one creates an object with different opacity
    SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(60, 255, 255, 0));
    // drawing of the graphic with the transparency
    g.FillRectangle(semiTransBrush, 0, 0, curImage.Width, curImage.Height);

    monImage.Dispose();
    monImage = curImage;

}

FONT AFTER

6.3. Black and White

For the transformation black and white of an image, you have several possibilities. We go utlized the method pixels by pixels. Will know that this method is long and that it can required several seconds for large files

/// <summary>
/// transformation black and white
/// </summary>

public void noirBlanc()
{
// creation of an image to the same dimension that the image source
    Bitmap tempImage = new Bitmap(monImage);
    int W=tempImage.Width, H=tempImage.Height;

// course the image to modify pixel by pixel
    for (int li=0; li<H; li++)
    for (int col=0; col<W; col++)
    {
        Color c = tempImage.GetPixel(col, li);
        int gris = (c.R + c.G + c.B)/3;// definite the gray color
        tempImage.SetPixel(col, li, Color.FromArgb(gris, gris, gris));// definite the gray color
    }
    monImage.Dispose();// dispose resources of the image source
    monImage = tempImage;// attribute with the image source the new image
}

ORIGINALE BLACK& WHITE



Articles de la même catégorie

 Pages : Top


173 Visites
0 Commentaires
Convert your XML pages in HTML
[10 mn de lecture - paru le 5/8/2004 1:12:11 PM - Public : Confirmé]

En savoir plus


323 Visites
0 Commentaires
Convertir un fichier XML en fichier HTML
[10 mn de lecture - paru le 5/8/2004 12:40:53 PM - Public : Confirmé]

En savoir plus


207 Visites
0 Commentaires
An introduction to XML
[20 mn de lecture - paru le 5/8/2004 11:23:36 AM - Public : Débutant]

En savoir plus

   Tous les Articles


SUPINFO Training Center peut vous proposer une formation ...

   Devenez Ingénieur Système Microsoft en 35 jours avec SUPINFO Training Center
   Devenez Certifiés Cisco en 13 jours avec SUPINFO Training Center
   Devenez Administrateur Système Microsoft avec SUPINFO Training Center
   Devenez Développeur Microsoft .NET en 13 jours avec SUPINFO Training Center



Powered by Campus-Booster Technology
Conditions d'utilisation & Copyright | Respect de la vie privée
© Copyright 1965-2006 Supinfo Paris, Paris Academy of Computer Science
Supinfo, Ecole Supérieure d'Informatique et Paris Academy Of Computer Science are trade marks.
23, rue de Château LANDON - 75010 PARIS - Phone : +33 (0) 153359 700 Fax : +33 (0) 153359 701

Web site autided by :