Class RasterImage

Class RasterImage

Nom dels espais: Aspose.Imaging Assemblea: Aspose.Imaging.dll (25.4.0)

Representa una imatge de raster que dóna suport a les operacions de gràfics de Raster.

public abstract class RasterImage : Image, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage

Derived

RasterCachedImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

Membres heretats

Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.UpdateContainer(Image) , Image.GetCanNotSaveMessage(ImageOptionsBase) , Image.GetFitRectangle(Rectangle) , Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter) , Image.GetFitRectangle(Rectangle, int[]) , Image.OnPaletteChanged(IColorPalette, IColorPalette) , Image.OnPaletteChanging(IColorPalette, IColorPalette) , Image.ReleaseManagedResources() , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.timeout , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.SaveData(Stream) , DataStreamSupporter.ReleaseManagedResources() , DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Aquest exemple mostra com carregar la informació de Pixel en un arreu de tipus de color, manipula l’arreu i la posa de nou a la imatge.Per realitzar aquestes operacions, aquest exemple crea un nou fitxer d’imatge (en format GIF) uisng Object MemoryStream.

//Create an instance of MemoryStream
                                                                                                                                                                                                                                                         using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                                                                                                                                                                         {
                                                                                                                                                                                                                                                             //Create an instance of GifOptions and set its various properties including the Source property
                                                                                                                                                                                                                                                             Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                                                                                                                                                                                                             gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                             //Create an instance of Image
                                                                                                                                                                                                                                                             using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 //Get the pixels of image by specifying the area as image boundary
                                                                                                                                                                                                                                                                 Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);

                                                                                                                                                                                                                                                                 //Loop over the Array and sets color of alrenative indexed pixel
                                                                                                                                                                                                                                                                 for (int index = 0; index < pixels.Length; index++)
                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                     if (index % 2 == 0)
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to yellow
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Yellow;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to blue
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Blue;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                 }

                                                                                                                                                                                                                                                                 //Apply the pixel changes to the image
                                                                                                                                                                                                                                                                 image.SavePixels(image.Bounds, pixels);

                                                                                                                                                                                                                                                                 // save all changes.
                                                                                                                                                                                                                                                                 image.Save();
                                                                                                                                                                                                                                                             }

                                                                                                                                                                                                                                                             // Write MemoryStream to File
                                                                                                                                                                                                                                                             using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 stream.WriteTo(fileStream);
                                                                                                                                                                                                                                                             }   
                                                                                                                                                                                                                                                         }

Constructors

RasterImage()

Inicialitza una nova instància de la classe Aspose.Imaging.RasterImage.

[JsonConstructor]
protected RasterImage()

RasterImage(Col·lecció)

Inicialitza una nova instància de la classe Aspose.Imaging.RasterImage.

protected RasterImage(IColorPalette colorPalette)

Parameters

colorPalette IColorPalette

La paleta de colors.

Fields

xmpData

Metadades de XMP

[JsonProperty]
protected XmpPacketWrapper xmpData

Valor de camp

XmpPacketWrapper

Properties

DataLoader

Obté o col·loca el carregador de dades.

[JsonProperty]
protected IRasterImageArgb32PixelLoader DataLoader { get; set; }

Valor de la propietat

IRasterImageArgb32PixelLoader

HasAlpha

Obté un valor que indica si aquesta instància té alfa.

public virtual bool HasAlpha { get; }

Valor de la propietat

bool

Examples

L’exemple següent carrega imatges de raster i imprimeix informació sobre el format de dades primeres i el canal alfa.

// The image files to load.
                                                                                                                    string[] fileNames = new string[]
                                                                                                                    {
                                                                                                                        @"c:\temp\sample.bmp",
                                                                                                                        @"c:\temp\alpha.png",
                                                                                                                    };

                                                                                                                    foreach (string fileName in fileNames)
                                                                                                                    {
                                                                                                                        using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
                                                                                                                        {
                                                                                                                            Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
                                                                                                                            System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, rasterImage.RawDataFormat, rasterImage.HasAlpha);
                                                                                                                        }
                                                                                                                    }

                                                                                                                    // The output may look like this:
                                                                                                                    // ImageFile=c:\temp\sample.bmp, FileFormat=Rgb24Bpp, used channels: 8,8,8, HasAlpha=False
                                                                                                                    // ImageFile=c:\temp\alpha.png, FileFormat=RGBA32Bpp, used channels: 8,8,8,8, HasAlpha=True

L’exemple següent mostra com extreure informació sobre el format de dades primeres i el canal alfa d’una imatge BMP.

// Create a 32-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 32, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Create a 24-bpp BMP image of 100 x 100 px.
                                                                                                                           using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 24, null))
                                                                                                                           {
                                                                                                                               System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
                                                                                                                           };

                                                                                                                           // Generally, BMP doesn't support alpha channel so the output will look like this:
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb32Bpp, used channels: 8,8,8,8, HasAlpha = False
                                                                                                                           // FileFormat = Bmp, RawDataFormat = Rgb24Bpp, used channels: 8,8,8, HasAlpha = False

HasTransparentColor

Obté un valor que indica si la imatge té color transparent.

public virtual bool HasTransparentColor { get; set; }

Valor de la propietat

bool

HorizontalResolution

Obté o estableix la resolució horitzontal, en píxels per polz, d’aquest Aspose.Imaging.RasterImage.

public virtual double HorizontalResolution { get; set; }

Valor de la propietat

double

Examples

L’exemple següent mostra com configurar la resolució horitzontal/vertical d’una imatge de raster.

string dir = "c:\\temp\\";

                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                   {
                                                                                                       Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                       // Get horizontal and vertical resolution of the image
                                                                                                       double horizontalResolution = rasterImage.HorizontalResolution;
                                                                                                       double verticalResolution = rasterImage.VerticalResolution;
                                                                                                       System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                       System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                       if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                       {
                                                                                                           // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                           System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                           rasterImage.SetResolution(96.0, 96.0);

                                                                                                           System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
                                                                                                           System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
                                                                                                       }

                                                                                                       // The output may look like this:
                                                                                                       // The horizontal resolution, in pixels per inch: 300
                                                                                                       // The vertical resolution, in pixels per inch: 300
                                                                                                       // Set resolution values to 96 dpi
                                                                                                       // The horizontal resolution, in pixels per inch: 96
                                                                                                       // The vertical resolution, in pixels per inch: 96
                                                                                                   }

Remarks

Nota per default aquest valor és sempre 96 ja que les diferents plataformes no poden retornar la resolució de la pantalla. pot considerar utilitzar el mètode SetResolution per actualitzar els dos valors de resolución en una sola trucada.

ImageOpacity

Obté la opacitat d’aquesta imatge.

public virtual float ImageOpacity { get; }

Valor de la propietat

float

IsRawDataAvailable

Obté un valor que indica si la càrrega de dades primeres és disponible.

public bool IsRawDataAvailable { get; }

Valor de la propietat

bool

PremultiplyComponents

Obté o estableix un valor que indiqui si els components de la imatge han de ser premultipliats.

public virtual bool PremultiplyComponents { get; set; }

Valor de la propietat

bool

Examples

L’exemple següent crea una nova imatge de raster, salva els píxels semi-transparents especificats, a continuació carrega aquests pixels i obté els colors finals en la forma prematura.

int imageWidth = 3;
                                                                                                                                                                                  int imageHeight = 2;

                                                                                                                                                                                  Aspose.Imaging.Color[] colors = new Aspose.Imaging.Color[]
                                                                                                                                                                                  {
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 255, 0, 0),
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 0, 255, 0),
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 0, 0, 255),
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 255, 255, 0),
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 255, 0, 255),
                                                                                                                                                                                      Aspose.Imaging.Color.FromArgb(127, 0, 255, 255),
                                                                                                                                                                                  };

                                                                                                                                                                                  Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                                                  createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
                                                                                                                                                                                  createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;

                                                                                                                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(createOptions, imageWidth, imageHeight))
                                                                                                                                                                                  {
                                                                                                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                      // Save pixels for the whole image.
                                                                                                                                                                                      rasterImage.SavePixels(rasterImage.Bounds, colors);

                                                                                                                                                                                      // The pixels are stored in the original image in the non-premultiplied form.
                                                                                                                                                                                      // Need to specify the corresponding option explicitly to obtain premultiplied color components.
                                                                                                                                                                                      // The premultiplied color components are calculated by the formulas:
                                                                                                                                                                                      // red = original_red * alpha / 255;
                                                                                                                                                                                      // green = original_green * alpha / 255;
                                                                                                                                                                                      // blue = original_blue * alpha / 255;
                                                                                                                                                                                      rasterImage.PremultiplyComponents = true;
                                                                                                                                                                                      Aspose.Imaging.Color[] premultipliedColors = rasterImage.LoadPixels(rasterImage.Bounds);

                                                                                                                                                                                      for (int i = 0; i < colors.Length; i++)
                                                                                                                                                                                      {
                                                                                                                                                                                          System.Console.WriteLine("Original color: {0}", colors[i].ToString());
                                                                                                                                                                                          System.Console.WriteLine("Premultiplied color: {0}", premultipliedColors[i].ToString());
                                                                                                                                                                                      }
                                                                                                                                                                                  }

RawCustomColorConverter

Obtenir o configurar el convertidor de color personalitzat

public IColorConverter RawCustomColorConverter { get; set; }

Valor de la propietat

IColorConverter

RawDataFormat

Obtenir el format de dades greus.

public virtual PixelDataFormat RawDataFormat { get; }

Valor de la propietat

PixelDataFormat

Examples

L’exemple següent carrega imatges de raster i imprimeix informació sobre el format de dades primeres i el canal alfa.

// The image files to load.
                                                                                                                    string[] fileNames = new string[]
                                                                                                                    {
                                                                                                                        @"c:\temp\sample.bmp",
                                                                                                                        @"c:\temp\alpha.png",
                                                                                                                    };

                                                                                                                    foreach (string fileName in fileNames)
                                                                                                                    {
                                                                                                                        using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
                                                                                                                        {
                                                                                                                            Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
                                                                                                                            System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, rasterImage.RawDataFormat, rasterImage.HasAlpha);
                                                                                                                        }
                                                                                                                    }

                                                                                                                    // The output may look like this:
                                                                                                                    // ImageFile=c:\temp\sample.bmp, FileFormat=Rgb24Bpp, used channels: 8,8,8, HasAlpha=False
                                                                                                                    // ImageFile=c:\temp\alpha.png, FileFormat=RGBA32Bpp, used channels: 8,8,8,8, HasAlpha=True

Aquest exemple mostra com carregar una imatge DJVU d’un flux de fitxers i imprimir informació sobre les pàgines.

string dir = "c:\\temp\\";

                                                                                                                // Load a DJVU image from a file stream.
                                                                                                                using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.djvu"))
                                                                                                                {
                                                                                                                    using (Aspose.Imaging.FileFormats.Djvu.DjvuImage djvuImage = new Aspose.Imaging.FileFormats.Djvu.DjvuImage(stream))
                                                                                                                    {
                                                                                                                        System.Console.WriteLine("The total number of pages: {0}", djvuImage.Pages.Length);
                                                                                                                        System.Console.WriteLine("The active page number:    {0}", djvuImage.ActivePage.PageNumber);
                                                                                                                        System.Console.WriteLine("The first page number:     {0}", djvuImage.FirstPage.PageNumber);
                                                                                                                        System.Console.WriteLine("The last page number:      {0}", djvuImage.LastPage.PageNumber);

                                                                                                                        foreach (Aspose.Imaging.FileFormats.Djvu.DjvuPage djvuPage in djvuImage.Pages)
                                                                                                                        {
                                                                                                                            System.Console.WriteLine("--------------------------------------------------");
                                                                                                                            System.Console.WriteLine("Page number:     {0}", djvuPage.PageNumber);
                                                                                                                            System.Console.WriteLine("Page size:       {0}", djvuPage.Size);
                                                                                                                            System.Console.WriteLine("Page raw format: {0}", djvuPage.RawDataFormat);
                                                                                                                        }
                                                                                                                    }
                                                                                                                }

                                                                                                                //The output may look like this:
                                                                                                                //The total number of pages: 2
                                                                                                                //The active page number:    1
                                                                                                                //The first page number:     1
                                                                                                                //The last page number:      2
                                                                                                                //--------------------------------------------------
                                                                                                                //Page number:     1
                                                                                                                //Page size:       { Width = 2481, Height = 3508}
                                                                                                                //Page raw format: RgbIndexed1Bpp, used channels: 1
                                                                                                                //--------------------------------------------------
                                                                                                                //Page number:     2
                                                                                                                //Page size:       { Width = 2481, Height = 3508}
                                                                                                                //Page raw format: RgbIndexed1Bpp, used channels: 1

RawDataSettings

Obté les configuracions de dades primeres actuals. Nota quan utilitzeu aquestes definicions les dades carreguen sense conversió.

[JsonIgnore]
public RawDataSettings RawDataSettings { get; }

Valor de la propietat

RawDataSettings

RawFallbackIndex

Obté o estableix l’índex fallback per utilitzar quan el palet està fora de límits

public int RawFallbackIndex { get; set; }

Valor de la propietat

int

RawIndexedColorConverter

Obtenir o configurar el convertidor de color indexat

public IIndexedColorConverter RawIndexedColorConverter { get; set; }

Valor de la propietat

IIndexedColorConverter

RawLineSize

Obté la mida de la línia cruda en bytes.

public virtual int RawLineSize { get; }

Valor de la propietat

int

TransparentColor

Obté el color transparent de la imatge.

public virtual Color TransparentColor { get; set; }

Valor de la propietat

Color

UpdateXmpData

Obté o estableix un valor que indiqui si actualitzar els metadats XMP.

public virtual bool UpdateXmpData { get; set; }

Valor de la propietat

bool

UsePalette

Obté un valor que indica si s’utilitza la paleta d’imatge.

public override bool UsePalette { get; }

Valor de la propietat

bool

UseRawData

Obté o estableix un valor que indiqui si s’utilitza la càrrega de dades primeres quan estigui disponible.

public virtual bool UseRawData { get; set; }

Valor de la propietat

bool

VerticalResolution

Obté o estableix la resolució vertical, en píxels per polz, d’aquest Aspose.Imaging.RasterImage.

public virtual double VerticalResolution { get; set; }

Valor de la propietat

double

Examples

L’exemple següent mostra com configurar la resolució horitzontal/vertical d’una imatge de raster.

string dir = "c:\\temp\\";

                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                   {
                                                                                                       Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                       // Get horizontal and vertical resolution of the image
                                                                                                       double horizontalResolution = rasterImage.HorizontalResolution;
                                                                                                       double verticalResolution = rasterImage.VerticalResolution;
                                                                                                       System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                       System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                       if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                       {
                                                                                                           // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                           System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                           rasterImage.SetResolution(96.0, 96.0);

                                                                                                           System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
                                                                                                           System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
                                                                                                       }

                                                                                                       // The output may look like this:
                                                                                                       // The horizontal resolution, in pixels per inch: 300
                                                                                                       // The vertical resolution, in pixels per inch: 300
                                                                                                       // Set resolution values to 96 dpi
                                                                                                       // The horizontal resolution, in pixels per inch: 96
                                                                                                       // The vertical resolution, in pixels per inch: 96
                                                                                                   }

Remarks

Nota per default aquest valor és sempre 96 ja que les diferents plataformes no poden retornar la resolució de la pantalla. pot considerar utilitzar el mètode SetResolution per actualitzar els dos valors de resolución en una sola trucada.

XmpData

Obté o col·loca els metadats XMP.

public virtual XmpPacketWrapper XmpData { get; set; }

Valor de la propietat

XmpPacketWrapper

Methods

AdjustBrightness(Int)

Ajustar una brillantor per a la imatge.

public virtual void AdjustBrightness(int brightness)

Parameters

brightness int

Valor de la llum.

Examples

L’exemple següent realitza la correcció de brillantor d’una imatge.

string dir = "c:\\temp\\";

                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                            {
                                                                                Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                // Set the brightness value. The accepted values of brightness are in the range [-255, 255].
                                                                                rasterImage.AdjustBrightness(50);
                                                                                rasterImage.Save(dir + "sample.AdjustBrightness.png");
                                                                            }

AdjustContrast(Float)

Imatge de contrast

public virtual void AdjustContrast(float contrast)

Parameters

contrast float

Valor de contrast (en rang [-100; 100])

Examples

L’exemple següent realitza la correcció de contrast d’una imatge.

string dir = "c:\\temp\\";

                                                                          using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                          {
                                                                              Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                              // Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
                                                                              rasterImage.AdjustContrast(50);
                                                                              rasterImage.Save(dir + "sample.AdjustContrast.png");
                                                                          }

AdjustGamma(Float, float i flot)

Correcció gamma d’una imatge.

public virtual void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)

Parameters

gammaRed float

Gamma per al coeficient de canals vermells

gammaGreen float

Gamma per al coeficient de canals verds

gammaBlue float

Gamma per al coeficient de canal blau

Examples

L’exemple següent realitza la correcció gamma d’una imatge aplicant diferents coeficients per als components de color.

string dir = "c:\\temp\\";

                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                            {
                                                                                                                                Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                // Set individual gamma coefficients for red, green and blue channels.
                                                                                                                                rasterImage.AdjustGamma(1.5f, 2.5f, 3.5f);
                                                                                                                                rasterImage.Save(dir + "sample.AdjustGamma.png");
                                                                                                                            }

AdjustGamma(Float)

Correcció gamma d’una imatge.

public virtual void AdjustGamma(float gamma)

Parameters

gamma float

Gamma per a canals vermell, verd i blau coeficient

Examples

L’exemple següent realitza la correcció gamma d’una imatge.

string dir = "c:\\temp\\";

                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                       {
                                                                           Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                           // Set gamma coefficient for red, green and blue channels.
                                                                           rasterImage.AdjustGamma(2.5f);
                                                                           rasterImage.Save(dir + "sample.AdjustGamma.png");
                                                                       }

BinarizeBradley(doble)

Binarització d’una imatge utilitzant l’algoritme de límit adaptatiu de Bradley mitjançant la limitació integral de la imatge

public virtual void BinarizeBradley(double brightnessDifference)

Parameters

brightnessDifference double

La diferència de brillantor entre el pixel i la mitjana d’una finestra s x s de píxels centrat al voltant d’aquest píxel.

BinarizeBradley(El doble, int)

Binarització d’una imatge utilitzant l’algoritme de límit adaptatiu de Bradley mitjançant la limitació integral de la imatge

public virtual void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

La diferència de brillantor entre el pixel i la mitjana d’una finestra s x s de píxels centrat al voltant d’aquest píxel.

windowSize int

La mida de la finestra s x s dels píxels centrat al voltant d’aquest píxel

Examples

L’exemple següent binaritza una imatge de raster amb l’algoritme d’adaptació amb la mida de la finestra especificada de Bradley. imatges binàries contenen només 2 colors - negre i blanc.

string dir = "c:\\temp\\";

                                                                                                                                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                                                                  {
                                                                                                                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                      // Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
                                                                                                                                                                                                      rasterImage.BinarizeBradley(5, 10);
                                                                                                                                                                                                      rasterImage.Save(dir + "sample.BinarizeBradley5_10x10.png");
                                                                                                                                                                                                  }

BinarizeFixed(El byte)

Binarització d’una imatge amb un límit predefinit

public virtual void BinarizeFixed(byte threshold)

Parameters

threshold byte

Si el valor gris corresponent d’un píxel és més gran que el límit, se li assignarà un valor de 255, 0 en cas contrari.

Examples

L’exemple següent binaritza una imatge de raster amb el límit predefinit. imatges binàries contenen només 2 colors - negre i blanc.

string dir = "c:\\temp\\";

                                                                                                                                                  using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                  {
                                                                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                      // Binarize the image with a threshold value of 127.
                                                                                                                                                      // If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
                                                                                                                                                      rasterImage.BinarizeFixed(127);
                                                                                                                                                      rasterImage.Save(dir + "sample.BinarizeFixed.png");
                                                                                                                                                  }

BinarizeOtsu()

Binarització d’una imatge amb el límit Otsu

public virtual void BinarizeOtsu()

Examples

L’exemple següent binaritza una imatge de raster amb el límit Otsu. imatges binàries contenen només 2 colors - negre i blanc.

string dir = "c:\\temp\\";

                                                                                                                                           using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                           {
                                                                                                                                               Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                               // Binarize the image with Otsu thresholding.
                                                                                                                                               rasterImage.BinarizeOtsu();
                                                                                                                                               rasterImage.Save(dir + "sample.BinarizeOtsu.png");
                                                                                                                                           }

Blend(Punt, RasterImage, Rectangle, byte)

barreja aquesta imatge amb la imatge overlay".

public virtual void Blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha = 255)

Parameters

origin Point

Imatge de fons d’origen mixte.

overlay RasterImage

Imatge de la superfície.

overlayArea Rectangle

L’àrea de la superfície.

overlayAlpha byte

La superfície alfa.

Blend(Punt, RasterImage, byte)

barreja aquesta imatge amb la imatge overlay".

public void Blend(Point origin, RasterImage overlay, byte overlayAlpha = 255)

Parameters

origin Point

Imatge de fons d’origen mixte.

overlay RasterImage

Imatge de la superfície.

overlayAlpha byte

La superfície alfa.

Dither(El mètode, int)

Performances que es refereixen a la imatge actual.

public void Dither(DitheringMethod ditheringMethod, int bitsCount)

Parameters

ditheringMethod DitheringMethod

El mètode de difusió.

bitsCount int

Els bits finals compten per a la difusió.

Examples

L’exemple següent carrega una imatge de raster i realitza el límit i la fluidificació utilitzant diferents profunditats de paleta.

string dir = "c:\\temp\\";

                                                                                                                               using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                               {
                                                                                                                                   Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                   // Perform threshold dithering using 4-bit color palette which contains 16 colors.
                                                                                                                                   // The more bits specified the higher quality and the bigger size of the output image.
                                                                                                                                   // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
                                                                                                                                   rasterImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4);

                                                                                                                                   rasterImage.Save(dir + "sample.ThresholdDithering4.png");
                                                                                                                               }

                                                                                                                               using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                               {
                                                                                                                                   Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                   // Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
                                                                                                                                   // The more bits specified the higher quality and the bigger size of the output image.
                                                                                                                                   // Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
                                                                                                                                   rasterImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1);

                                                                                                                                   rasterImage.Save(dir + "sample.FloydSteinbergDithering1.png");
                                                                                                                               }

Dither(DitheringMetode, int, IColorPalette)

Performances que es refereixen a la imatge actual.

public abstract void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)

Parameters

ditheringMethod DitheringMethod

El mètode de difusió.

bitsCount int

Els bits finals compten per a la difusió.

customPalette IColorPalette

El costum de la paleta per a la difusió.

Filter(Rectangle, FilterOptionsBase)

Filtra el rectangle especificat.

public virtual void Filter(Rectangle rectangle, FilterOptionsBase options)

Parameters

rectangle Rectangle

El rectangle

options FilterOptionsBase

Les opcions.

Examples

L’exemple següent aplica diversos tipus de filtres a una imatge de raster.

string dir = "c:\\temp\\";

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a median filter with a rectangle size of 5 to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
                                                                                        rasterImage.Save(dir + "sample.MedianFilter.png");
                                                                                    }

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
                                                                                        rasterImage.Save(dir + "sample.BilateralSmoothingFilter.png");
                                                                                    }

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
                                                                                        rasterImage.Save(dir + "sample.GaussianBlurFilter.png");
                                                                                    }

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
                                                                                        rasterImage.Save(dir + "sample.GaussWienerFilter.png");
                                                                                    }

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
                                                                                        rasterImage.Save(dir + "sample.MotionWienerFilter.png");
                                                                                    }

                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                    {
                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                        // Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
                                                                                        rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
                                                                                        rasterImage.Save(dir + "sample.SharpenFilter.png");
                                                                                    }

GetArgb32Pixel(Int, Int)

Obté una imatge de 32-bit ARGB píxel.

public int GetArgb32Pixel(int x, int y)

Parameters

x int

La posició del pixel x.

y int

El pixel i la ubicació.

Returns

int

El píxel ARGB de 32 bits per a la ubicació especificada.

Examples

L’exemple següent carrega una imatge de raster i obté el color d’un pixel arbitràri representat com un valor integral de 32 bits.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
                                                                                                                                        {
                                                                                                                                            Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                            // Get an integer representation of the color of the top-left pixel of the image.
                                                                                                                                            int color = rasterImage.GetArgb32Pixel(0, 0);

                                                                                                                                            // To obtain the values of the individual color components, shift the color value by a corresponding number of bits
                                                                                                                                            int alpha = (color >> 24) & 0xff;
                                                                                                                                            int red = (color >> 16) & 0xff;
                                                                                                                                            int green = (color >> 8) & 0xff;
                                                                                                                                            int blue = (color >> 0) & 0xff;

                                                                                                                                            System.Console.WriteLine("The color of the pixel(0,0) is A={0},R={1},G={2},B={3}", alpha, red, green, blue);
                                                                                                                                        }

L’exemple següent mostra com el caching d’imatge afecta el rendiment.En general, la lectura de dades cache es realitza més ràpid que la llegència de les dades no caixades.

string dir = "c:\\temp\\";

                                                                                                                                                                    // Load an image from a PNG file.
                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                                    {
                                                                                                                                                                        // Cache all pixel data so that no additional data loading will be performed from the underlying data stream
                                                                                                                                                                        image.CacheData();

                                                                                                                                                                        System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
                                                                                                                                                                        stopwatch.Start();

                                                                                                                                                                        // Reading all pixels is pretty fast.
                                                                                                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
                                                                                                                                                                        for (int y = 0; y < image.Height; y++)
                                                                                                                                                                        {
                                                                                                                                                                            for (int x = 0; x < image.Width; x++)
                                                                                                                                                                            {
                                                                                                                                                                                int color = rasterImage.GetArgb32Pixel(x, y);
                                                                                                                                                                            }
                                                                                                                                                                        }

                                                                                                                                                                        stopwatch.Stop();
                                                                                                                                                                        System.Console.WriteLine("Reading all cached pixels took {0} ms.", stopwatch.ElapsedMilliseconds);
                                                                                                                                                                    }

                                                                                                                                                                    // Load an image from a PNG file
                                                                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                                    {
                                                                                                                                                                        System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
                                                                                                                                                                        stopwatch.Start();

                                                                                                                                                                        // Reading all pixels is not as fast as when caching
                                                                                                                                                                        Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
                                                                                                                                                                        for (int y = 0; y < image.Height; y++)
                                                                                                                                                                        {
                                                                                                                                                                            for (int x = 0; x < image.Width; x++)
                                                                                                                                                                            {
                                                                                                                                                                                int color = rasterImage.GetArgb32Pixel(x, y);
                                                                                                                                                                            }
                                                                                                                                                                        }

                                                                                                                                                                        stopwatch.Stop();
                                                                                                                                                                        System.Console.WriteLine("Reading all pixels without preliminary caching took {0} ms.", stopwatch.ElapsedMilliseconds);
                                                                                                                                                                    }

                                                                                                                                                                    // The output may look like this:
                                                                                                                                                                    // Reading all cached pixels took 1500 ms.
                                                                                                                                                                    // Reading all pixels without preliminary caching took 150000 ms.

GetDefaultArgb32Pixels(Rectangle)

Obté l’arrel de píxels ARGB de 32 bits.

public int[] GetDefaultArgb32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per obtenir píxels per.

Returns

int []

Els píxels estàndard s’arreglen.

GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader)

Obté els píxels estàndard arreu utilitzant un carregador de píxel parcial.

public void GetDefaultPixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

El rectangle per obtenir píxels per.

partialPixelLoader IPartialArgb32PixelLoader

El carregador de píxels parcial.

GetDefaultRawData(Rectangle, IPartialRawDataLoader, Instal·lacions de dades)

Obté l’arxiu de dades primeres de forma default utilitzant un carregador de píxels parcial.

public void GetDefaultRawData(Rectangle rectangle, IPartialRawDataLoader partialRawDataLoader, RawDataSettings rawDataSettings)

Parameters

rectangle Rectangle

El rectangle per obtenir píxels per.

partialRawDataLoader IPartialRawDataLoader

El carregador de dades greus parcial.

rawDataSettings RawDataSettings

Les configuracions de dades greus.

GetDefaultRawData(Rectangle i RawDataSettings)

Obté l’arrel de dades greus default.

public byte[] GetDefaultRawData(Rectangle rectangle, RawDataSettings rawDataSettings)

Parameters

rectangle Rectangle

El rectangle per obtenir dades greus per.

rawDataSettings RawDataSettings

Les configuracions de dades greus.

Returns

byte []

L’arranjament de dades greus estàndard.

GetModifyDate(La botiga)

Obté la data i l’hora que la imatge de la font s’ha modificat per última vegada.

public virtual DateTime GetModifyDate(bool useDefault)

Parameters

useDefault bool

si s’estableix a ’true’ utilitza la informació de FileInfo com a valor estàndard.

Returns

DateTime

La data i l’hora de la imatge de recursos es va modificar per última vegada.

GetPixel(Int, Int)

Obtenir un pixel d’imatge.

public Color GetPixel(int x, int y)

Parameters

x int

La posició del pixel x.

y int

El pixel i la ubicació.

Returns

Color

El color del pixel per a la ubicació especificada.

Examples

L’exemple següent carrega una imatge de raster i obté el color d’un pixel arbitràri.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
                                                                                                  {
                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                      // Get the color of the top-left pixel of the image.
                                                                                                      Color color = rasterImage.GetPixel(0, 0);

                                                                                                      // Obtain the values of the individual color components
                                                                                                      byte alpha = color.A;
                                                                                                      byte red = color.R;
                                                                                                      int green = color.G;
                                                                                                      int blue = color.B;

                                                                                                      System.Console.WriteLine("The color of the pixel(0,0) is A={0},R={1},G={2},B={3}", alpha, red, green, blue);
                                                                                                  }

GetSkewAngle()

Obtenir l’angle de esquiva.Aquest mètode s’aplica als documents de text escanejats, per determinar l’angle d’esquena quan es scana.

public float GetSkewAngle()

Returns

float

L’angle de l’escut, en graus.

Grayscale()

Transformació d’una imatge a la seva representació griscal

public virtual void Grayscale()

Examples

L’exemple següent transforma una imatge de raster colorida en la seva representació de grais. Les imatges de Grais són compostes exclusivament d’ombres de gris i porten només informació de intensitat.

string dir = "c:\\temp\\";

                                                                                                                                                                                                     using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                                                                     {
                                                                                                                                                                                                         Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                         rasterImage.Grayscale();
                                                                                                                                                                                                         rasterImage.Save(dir + "sample.Grayscale.png");
                                                                                                                                                                                                     }

LoadArgb32Pixels(Rectangle)

Carrega píxels ARGB de 32 bits.

public int[] LoadArgb32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per carregar píxels de.

Returns

int []

El carregat 32-bit ARGB píxels arreu.

Examples

L’exemple següent mostra com carregar i processar els píxels d’una imatge de raster. Els pixels es representen com a valors integrals de 32 bits. Per exemple, considereu un problema de comptar amb píxel totalment transparents de la imatge.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                                                      // Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadArgb32Pixels method.
                                                                                                                                                                                                                                      int[] pixels = rasterImage.LoadArgb32Pixels(rasterImage.Bounds);

                                                                                                                                                                                                                                      int count = 0;
                                                                                                                                                                                                                                      foreach (int pixel in pixels)
                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                          int alpha = (pixel >> 24) & 0xff;
                                                                                                                                                                                                                                          if (alpha == 0)
                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                              count++;
                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                      System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
                                                                                                                                                                                                                                      System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                                                                                  }

LoadArgb64Pixels(Rectangle)

Carrega píxels ARGB de 64 bits.

public long[] LoadArgb64Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per carregar píxels de.

Returns

long []

El carregat 64-bit ARGB píxels arreu.

Examples

L’exemple següent mostra com carregar i processar els píxels d’una imatge de raster. Els pixels es representen com a valors integrals de 64 bits. Per exemple, considereu un problema de comptar amb píxel totalment transparents de la imatge.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\16rgba.png"))
                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                      Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                                                      // Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadArgb64Pixels method.
                                                                                                                                                                                                                                      // Note that the image itself must have 16 bits per sample, because Aspose.Imaging.RasterImage.LoadArgb64Pixels doesn't work with 8 bit per sample.
                                                                                                                                                                                                                                      // In order to work with 8 bits per sample please use the good old Aspose.Imaging.RasterImage.LoadArgb32Pixels method.
                                                                                                                                                                                                                                      long[] pixels = rasterImage.LoadArgb64Pixels(rasterImage.Bounds);

                                                                                                                                                                                                                                      int count = 0;
                                                                                                                                                                                                                                      foreach (int pixel in pixels)
                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                          // Note that all color components including alpha are represented by 16-bit values, so their allowed values are in the range [0, 63535].
                                                                                                                                                                                                                                          int alpha = (pixel >> 48) & 0xffff;
                                                                                                                                                                                                                                          if (alpha == 0)
                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                              count++;
                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                      System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
                                                                                                                                                                                                                                      System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                                                                                  }

LoadCmyk32Pixels(Rectangle)

Carrega píxels en format CMYK.

public int[] LoadCmyk32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per carregar píxels de.

Returns

int []

Els píxels de CMYK carregats presenten com a valors inàgics de 32 bits.

LoadCmykPixels(Rectangle)

Carrega píxels en format CMYK.Si us plau, utilitzeu més eficaç el mètode Aspose.Imaging.RasterImage.LoadCmyk32Pixels(__W L17_Rectangle).

[Obsolete("Method is obsolete")]
public CmykColor[] LoadCmykPixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per carregar píxels de.

Returns

CmykColor []

La càrrega de píxels CMYK array.

LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader)

Carrega 32-bit ARGB píxels parcialment per paquets.

public void LoadPartialArgb32Pixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

El rectangle desitjat.

partialPixelLoader IPartialArgb32PixelLoader

El carregador de píxels ARGB de 32 bits.

Examples

L’exemple següent mostra com carregar i processar els píxels d’una imatge de raster utilitzant el seu propi processador parcial. Per exemple, considereu un problema de comptabilitat de pixels completament transparents de una imatge. per tal de comptar píixels transparent mitjançant el mecanisme de càrrega parcial, s’introdueix una classe separada TransparentArgb32PixelCounter implementing Aspose.Imaging.IPartialArGB32PixelLoader.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
                                                                                                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                                                                                            Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                                                                                                                                                                                                                            // Create an instance of the Aspose.Imaging.IPartialArgb32PixelLoader and pass it to the Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels
                                                                                                                                                                                                                                                                                                                                                                                                            TransparentArgb32PixelCounter counter = new TransparentArgb32PixelCounter();

                                                                                                                                                                                                                                                                                                                                                                                                            // Load pixels for the whole image. Any rectangular part of the image can be specified as the first parameter of the Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels method.
                                                                                                                                                                                                                                                                                                                                                                                                            rasterImage.LoadPartialArgb32Pixels(rasterImage.Bounds, counter);

                                                                                                                                                                                                                                                                                                                                                                                                            System.Console.WriteLine("The number of fully transparent pixels is {0}", counter.Count);
                                                                                                                                                                                                                                                                                                                                                                                                            System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                                                                                                                                                        // The counter may look like this:        
                                                                                                                                                                                                                                                                                                                                                                                                        /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                                        /// Counts the number of fully transparent pixels with alpha channel value of 0.
                                                                                                                                                                                                                                                                                                                                                                                                        /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                                        private class TransparentArgb32PixelCounter : IPartialArgb32PixelLoader
                                                                                                                                                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                                                                                                                                                            /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                                            /// The number of fully transparent pixels.
                                                                                                                                                                                                                                                                                                                                                                                                            /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                                            private int count;

                                                                                                                                                                                                                                                                                                                                                                                                            /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                                            /// Gets the number of fully transparent pixels.
                                                                                                                                                                                                                                                                                                                                                                                                            /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                                            public int Count
                                                                                                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                                                                                                                get { return this.count; }
                                                                                                                                                                                                                                                                                                                                                                                                            }

                                                                                                                                                                                                                                                                                                                                                                                                            /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                                            /// Processes the loaded pixels. This method is called back every time when a new portion of pixels is loaded.
                                                                                                                                                                                                                                                                                                                                                                                                            /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                                            /// <param name="pixelsRectangle"/>The pixels rectangle.
                                                                                                                                                                                                                                                                                                                                                                                                            /// <param name="pixels"/>The 32-bit ARGB pixels.
                                                                                                                                                                                                                                                                                                                                                                                                            /// <param name="start"/>The start pixels point.
                                                                                                                                                                                                                                                                                                                                                                                                            /// <param name="end"/>The end pixels point.
                                                                                                                                                                                                                                                                                                                                                                                                            public void Process(Aspose.Imaging.Rectangle pixelsRectangle, int[] pixels, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
                                                                                                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                                                                                                                foreach (int pixel in pixels)
                                                                                                                                                                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                                                                                                                                                                    int alpha = (pixel &gt;&gt; 24) &amp; 0xff;
                                                                                                                                                                                                                                                                                                                                                                                                                    if (alpha == 0)
                                                                                                                                                                                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                                                                                                                                                                                        this.count++;
                                                                                                                                                                                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                                                                                                        }

LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader)

Carrega 64-bit ARGB píxels parcialment per paquets.

public void LoadPartialArgb64Pixels(Rectangle rectangle, IPartialArgb64PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

El rectangle desitjat.

partialPixelLoader IPartialArgb64PixelLoader

El carregador de píxels ARGB de 64 bits.

LoadPartialPixels(Rectangle i IPartialPixelLoader)

Carrega els píxels parcialment per paquets.

public void LoadPartialPixels(Rectangle desiredRectangle, IPartialPixelLoader pixelLoader)

Parameters

desiredRectangle Rectangle

El rectangle desitjat.

pixelLoader IPartialPixelLoader

El carregador de pixels.

Examples

L’exemple següent mostra com carregar i processar els píxels d’una imatge de raster utilitzant el seu propi processador parcial. Per exemple, considereu un problema de comptabilitat de pixels de la imatge completament transparents. per tal de comptar transparent mitjançant el mecanisme de càrrega parcial, s’introdueix una classe separada TransparentPixelCounter implementant Aspose.Imaging.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
                                                                                                                                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                                                                                                                                         Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                                                                                                                                                                                                                         // Create an instance of the Aspose.Imaging.IPartialPixelLoader and pass it to the Aspose.Imaging.RasterImage.LoadPartialPixels
                                                                                                                                                                                                                                                                                                                                                                                         TransparentPixelCounter counter = new TransparentPixelCounter();

                                                                                                                                                                                                                                                                                                                                                                                         // Load pixels for the whole image. Any rectangular part of the image can be specified as the first parameter of the Aspose.Imaging.RasterImage.LoadPartialPixels method.
                                                                                                                                                                                                                                                                                                                                                                                         rasterImage.LoadPartialPixels(rasterImage.Bounds, counter);

                                                                                                                                                                                                                                                                                                                                                                                         System.Console.WriteLine("The number of fully transparent pixels is {0}", counter.Count);
                                                                                                                                                                                                                                                                                                                                                                                         System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                                                                                                                                                                                                                                     }

                                                                                                                                                                                                                                                                                                                                                                                     // The counter may look like this:
                                                                                                                                                                                                                                                                                                                                                                                     /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                     /// Counts the number of fully transparent pixels with alpha channel value of 0.
                                                                                                                                                                                                                                                                                                                                                                                     /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                     private class TransparentPixelCounter : IPartialPixelLoader
                                                                                                                                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                                                                                                                                         /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                         /// The number of fully transparent pixels.
                                                                                                                                                                                                                                                                                                                                                                                         /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                         private int count;

                                                                                                                                                                                                                                                                                                                                                                                         /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                         /// Gets the number of fully transparent pixels.
                                                                                                                                                                                                                                                                                                                                                                                         /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                         public int Count
                                                                                                                                                                                                                                                                                                                                                                                         {
                                                                                                                                                                                                                                                                                                                                                                                             get { return this.count; }
                                                                                                                                                                                                                                                                                                                                                                                         }

                                                                                                                                                                                                                                                                                                                                                                                         /// <summary>
                                                                                                                                                                                                                                                                                                                                                                                         /// Processes the loaded pixels. This method is called back every time when a new portion of pixels is loaded.
                                                                                                                                                                                                                                                                                                                                                                                         /// </summary>
                                                                                                                                                                                                                                                                                                                                                                                         /// <param name="pixelsRectangle"/>The pixels rectangle.
                                                                                                                                                                                                                                                                                                                                                                                         /// <param name="pixels"/>The 32-bit ARGB pixels.
                                                                                                                                                                                                                                                                                                                                                                                         /// <param name="start"/>The start pixels point.
                                                                                                                                                                                                                                                                                                                                                                                         /// <param name="end"/>The end pixels point.
                                                                                                                                                                                                                                                                                                                                                                                         public void Process(Aspose.Imaging.Rectangle pixelsRectangle, Aspose.Imaging.Color[] pixels, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
                                                                                                                                                                                                                                                                                                                                                                                         {
                                                                                                                                                                                                                                                                                                                                                                                             foreach (Color pixel in pixels)
                                                                                                                                                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                                                                                                                                                 if (pixel.A == 0)
                                                                                                                                                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                                                                                                                                                     this.count++;
                                                                                                                                                                                                                                                                                                                                                                                                 }
                                                                                                                                                                                                                                                                                                                                                                                             }
                                                                                                                                                                                                                                                                                                                                                                                         }
                                                                                                                                                                                                                                                                                                                                                                                     }

LoadPixels(Rectangle)

Càrrega de píxels.

public Color[] LoadPixels(Rectangle rectangle)

Parameters

rectangle Rectangle

El rectangle per carregar píxels de.

Returns

Color []

Els píxels carregats.

Examples

L’exemple següent mostra com carregar i processar els píxels d’una imatge de raster. per exemple, considereu un problema de comptabilització de pixels de la imatge completament transparents.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
                                                                                                                                                                             {
                                                                                                                                                                                 Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                                                 // Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadPixels method.
                                                                                                                                                                                 Color[] pixels = rasterImage.LoadPixels(rasterImage.Bounds);

                                                                                                                                                                                 int count = 0;
                                                                                                                                                                                 foreach (Color pixel in pixels)
                                                                                                                                                                                 {
                                                                                                                                                                                     if (pixel.A == 0)
                                                                                                                                                                                     {
                                                                                                                                                                                         count++;
                                                                                                                                                                                     }
                                                                                                                                                                                 }

                                                                                                                                                                                 System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
                                                                                                                                                                                 System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                             }

Aquest exemple mostra com carregar la informació de Pixel en un arreu de tipus de color, manipula l’arreu i la posa de nou a la imatge.Per realitzar aquestes operacions, aquest exemple crea un nou fitxer d’imatge (en format GIF) uisng Object MemoryStream.

//Create an instance of MemoryStream
                                                                                                                                                                                                                                                         using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                                                                                                                                                                         {
                                                                                                                                                                                                                                                             //Create an instance of GifOptions and set its various properties including the Source property
                                                                                                                                                                                                                                                             Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                                                                                                                                                                                                             gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                             //Create an instance of Image
                                                                                                                                                                                                                                                             using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 //Get the pixels of image by specifying the area as image boundary
                                                                                                                                                                                                                                                                 Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);

                                                                                                                                                                                                                                                                 //Loop over the Array and sets color of alrenative indexed pixel
                                                                                                                                                                                                                                                                 for (int index = 0; index &lt; pixels.Length; index++)
                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                     if (index % 2 == 0)
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to yellow
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Yellow;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to blue
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Blue;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                 }

                                                                                                                                                                                                                                                                 //Apply the pixel changes to the image
                                                                                                                                                                                                                                                                 image.SavePixels(image.Bounds, pixels);

                                                                                                                                                                                                                                                                 // save all changes.
                                                                                                                                                                                                                                                                 image.Save();
                                                                                                                                                                                                                                                             }

                                                                                                                                                                                                                                                             // Write MemoryStream to File
                                                                                                                                                                                                                                                             using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 stream.WriteTo(fileStream);
                                                                                                                                                                                                                                                             }   
                                                                                                                                                                                                                                                         }

LoadRawData(Rectangle, RawDataSettings, IPartialRawDatLoader)

càrrega de dades greus.

public void LoadRawData(Rectangle rectangle, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)

Parameters

rectangle Rectangle

El rectangle per carregar les dades primeres de.

rawDataSettings RawDataSettings

Les configuracions de dades brutes per utilitzar per a les dades carregades.S’ha de tenir en compte que si els dades no estan en el format especificat llavors es realitzarà la conversió de datos.

rawDataLoader IPartialRawDataLoader

El carregador de dades greus.

Examples

L’exemple següent mostra com extreure píxels de les dades d’imatge cruda utilitzant RawDataSettings. per exemple, considereu un problema de comptar píxel totalment transparent d’una imatge.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\GrayscaleWithAlpha.png"))
                                                                                                                                                                                                {
                                                                                                                                                                                                    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
                                                                                                                                                                                                    Aspose.Imaging.RawDataSettings settings = rasterImage.RawDataSettings;

                                                                                                                                                                                                    TransparentPixelRawDataCounter rawDataLoader = new TransparentPixelRawDataCounter(settings);

                                                                                                                                                                                                    // Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadRawData method.
                                                                                                                                                                                                    rasterImage.LoadRawData(rasterImage.Bounds, settings, rawDataLoader);

                                                                                                                                                                                                    System.Console.WriteLine("The number of fully transparent pixels is {0}", rawDataLoader.Count);
                                                                                                                                                                                                    System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
                                                                                                                                                                                                }

                                                                                                                                                                                                // In case of raw data, the counter may look like this:
                                                                                                                                                                                                /// <summary>
                                                                                                                                                                                                /// Counts the number of fully transparent pixels with alpha channel value of 0.
                                                                                                                                                                                                /// </summary>
                                                                                                                                                                                                private class TransparentPixelRawDataCounter : IPartialRawDataLoader
                                                                                                                                                                                                {
                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// The number of fully transparent pixels.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    private int count;

                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// The raw data settings of the loaded image.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    private Aspose.Imaging.RawDataSettings rawDataSettings;

                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// Gets the number of fully transparent pixels.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    public int Count
                                                                                                                                                                                                    {
                                                                                                                                                                                                        get { return this.count; }
                                                                                                                                                                                                    }

                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// Initializes a new instance of the <see transparentpixelrawdatacounter=""></see> class.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    /// <param name="settings"/>The raw data settings allow to extract color components from raw data.
                                                                                                                                                                                                    public TransparentPixelRawDataCounter(Aspose.Imaging.RawDataSettings settings)
                                                                                                                                                                                                    {
                                                                                                                                                                                                        this.rawDataSettings = settings;
                                                                                                                                                                                                        this.count = 0;
                                                                                                                                                                                                    }

                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// Processes the loaded raw data. This method is called back every time when a new portion of raw data is loaded.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    /// <param name="dataRectangle"/>The raw data rectangle.
                                                                                                                                                                                                    /// <param name="data"/>The raw data.
                                                                                                                                                                                                    /// <param name="start"/>The start data point.
                                                                                                                                                                                                    /// <param name="end"/>The end data point.
                                                                                                                                                                                                    public void Process(Aspose.Imaging.Rectangle dataRectangle, byte[] data, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
                                                                                                                                                                                                    {
                                                                                                                                                                                                        int[] channelBits = this.rawDataSettings.PixelDataFormat.ChannelBits;

                                                                                                                                                                                                        // Only simple formats are consdired here to simplify the code.
                                                                                                                                                                                                        // Let's consider only images with 8 bits per sample.
                                                                                                                                                                                                        for (int i = 0; i &lt; channelBits.Length; i++)
                                                                                                                                                                                                        {
                                                                                                                                                                                                            if (channelBits[i] != 8)
                                                                                                                                                                                                            {
                                                                                                                                                                                                                throw new System.NotSupportedException();
                                                                                                                                                                                                            }
                                                                                                                                                                                                        }

                                                                                                                                                                                                        switch (this.rawDataSettings.PixelDataFormat.PixelFormat)
                                                                                                                                                                                                        {
                                                                                                                                                                                                            case PixelFormat.Rgb:
                                                                                                                                                                                                            case PixelFormat.Bgr:
                                                                                                                                                                                                                {
                                                                                                                                                                                                                    if (channelBits.Length == 4)
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                        // ARGB
                                                                                                                                                                                                                        for (int i = 0; i &lt; data.Length; i += 4)
                                                                                                                                                                                                                        {
                                                                                                                                                                                                                            // The alpha channel is stored last, after the color components.
                                                                                                                                                                                                                            if (data[i + 3] == 0)
                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                this.count++;
                                                                                                                                                                                                                            }
                                                                                                                                                                                                                        }
                                                                                                                                                                                                                    }
                                                                                                                                                                                                                }
                                                                                                                                                                                                                break;

                                                                                                                                                                                                            case PixelFormat.Grayscale:
                                                                                                                                                                                                                {
                                                                                                                                                                                                                    if (channelBits.Length == 2)
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                        // Grayscale Alpha
                                                                                                                                                                                                                        for (int i = 0; i &lt; data.Length; i += 2)
                                                                                                                                                                                                                        {
                                                                                                                                                                                                                            // The alpha channel is stored last, after the color components.
                                                                                                                                                                                                                            if (data[i + 1] == 0)
                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                this.count++;
                                                                                                                                                                                                                            }
                                                                                                                                                                                                                        }
                                                                                                                                                                                                                    }
                                                                                                                                                                                                                }
                                                                                                                                                                                                                break;

                                                                                                                                                                                                            default:
                                                                                                                                                                                                                throw new System.ArgumentOutOfRangeException("PixelFormat");
                                                                                                                                                                                                        }
                                                                                                                                                                                                    }

                                                                                                                                                                                                    /// <summary>
                                                                                                                                                                                                    /// Processes the loaded raw data. This method is called back every time when a new portion of raw data is loaded.
                                                                                                                                                                                                    /// </summary>
                                                                                                                                                                                                    /// <param name="dataRectangle"/>The raw data rectangle.
                                                                                                                                                                                                    /// <param name="data"/>The raw data.
                                                                                                                                                                                                    /// <param name="start"/>The start data point.
                                                                                                                                                                                                    /// <param name="end"/>The end data point.
                                                                                                                                                                                                    /// <param name="loadOptions"/>The load options.
                                                                                                                                                                                                    public void Process(Aspose.Imaging.Rectangle dataRectangle, byte[] data, Aspose.Imaging.Point start, Aspose.Imaging.Point end, Aspose.Imaging.LoadOptions loadOptions)
                                                                                                                                                                                                    {
                                                                                                                                                                                                        this.Process(dataRectangle, data, start, end);
                                                                                                                                                                                                    }
                                                                                                                                                                                                }

LoadRawData(Rectangle, RawDataSettings, IPartialRawDatLoader)

càrrega de dades greus.

public void LoadRawData(Rectangle rectangle, Rectangle destImageBounds, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)

Parameters

rectangle Rectangle

El rectangle per carregar les dades primeres de.

destImageBounds Rectangle

Els límits de la imatge.

rawDataSettings RawDataSettings

Les configuracions de dades brutes per utilitzar per a les dades carregades.S’ha de tenir en compte que si els dades no estan en el format especificat llavors es realitzarà la conversió de datos.

rawDataLoader IPartialRawDataLoader

El carregador de dades greus.

NormalizeAngle()

Normalitza l’angle.Aquest mètode s’aplica als documents de text escanats per desfer-se de l’escàndol esquit.Aquest mètode utilitza els mètodes Aspose.Imaging.RasterImage.GetSkewAngle i Wl17. Raster Image (System.Single).

public void NormalizeAngle()

NormalizeAngle(El color, el color)

Normalitza l’angle.Aquest mètode s’aplica als documents de text escanats per desfer-se de l’escàndol esquit.Aquest mètode utilitza els mètodes Aspose.Imaging.RasterImage.GetSkewAngle i W L17. Raster Image .Rotate(System.Single, System.Boolean,Wl17__.Color).

public virtual void NormalizeAngle(bool resizeProportionally, Color backgroundColor)

Parameters

resizeProportionally bool

si s’estableix a ’true’ haurà canviat la mida de la imatge d’acord amb les projeccions rectangles (punts de cor) girats en un altre cas que deixen les dimensions sense tocar i només els continguts de l’imatge intern es giren.

backgroundColor Color

El color del fons.

Examples

Skew és un artefacte que podria aparèixer durant el procés d’escaneig de documents quan el text / imatges del document es giren en un angle lleu. Pot tenir diverses causes però el més comú és que el paper es troba mal lloc durant un scan. Per tant, deskev és el processus de detectar i fixar aquest problema en arxius escanejats (és a dir, bitmap) de manera que els documents desquebrats tindran el Text / les imatges correctament i horitzontalment ajustats.

string dir = "c:\\aspose.imaging\\issues\\net\\3567\\";

                                                                                                                                                                                                                                                                                                                                                                                                                                          string inputFilePath = dir + "skewed.png";
                                                                                                                                                                                                                                                                                                                                                                                                                                          string outputFilePath = dir + "skewed.out.png";

                                                                                                                                                                                                                                                                                                                                                                                                                                          // Get rid of the skewed scan with default parameters
                                                                                                                                                                                                                                                                                                                                                                                                                                          using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(inputFilePath))
                                                                                                                                                                                                                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                                                                                                                                                                                                                              // Deskew
                                                                                                                                                                                                                                                                                                                                                                                                                                              image.NormalizeAngle(false /*do not resize*/, Aspose.Imaging.Color.LightGray /*background color*/);
                                                                                                                                                                                                                                                                                                                                                                                                                                              image.Save(outputFilePath);
                                                                                                                                                                                                                                                                                                                                                                                                                                          }

NormalizeHistogram()

Normalitza l’histogram d’imatge - ajusta els valors de píxels per utilitzar tot el rang disponible.

public virtual void NormalizeHistogram()

ReadArgb32ScanLine(Int)

Llegeix tota la línia d’escaneig per l’índex de línia de scane especificada.

public int[] ReadArgb32ScanLine(int scanLineIndex)

Parameters

scanLineIndex int

Índex basat en zero de la línia d’escaneig.

Returns

int []

La línia d’escaneig 32-bit ARGB valors de color arreu.

ReadScanLine(Int)

Llegeix tota la línia d’escaneig per l’índex de línia de scane especificada.

public Color[] ReadScanLine(int scanLineIndex)

Parameters

scanLineIndex int

Índex basat en zero de la línia d’escaneig.

Returns

Color []

La línia d’escaneig dels valors de color del pixel.

ReleaseManagedResources()

Assegureu-vos que no es lliuren recursos no gestionats aquí, ja que poden haver estat ja alliberats.

protected override void ReleaseManagedResources()

RemoveMetadata()

Elimina aquest metadades d’exemple de la imatge per configurar aquest valor Aspose.Imaging.Xmp.IHasXMPData. Null.

public override void RemoveMetadata()

ReplaceColor(color, byte i color)

Reemplaça un color a l’altre amb la diferència permesa i conserva el valor alfa original per tal d’emmagatzemar extrems suaves.

public void ReplaceColor(Color oldColor, byte oldColorDiff, Color newColor)

Parameters

oldColor Color

El color que s’ha de substituir.

oldColorDiff byte

Permet la diferència en el color antic per poder ampliar el to de color substituït.

newColor Color

Un nou color per reemplaçar el vell amb un altre.

ReplaceColor(Int, byte i int)

Reemplaça un color a l’altre amb la diferència permesa i conserva el valor alfa original per tal d’emmagatzemar extrems suaves.

public virtual void ReplaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)

Parameters

oldColorArgb int

Vell color ARGB valor per ser substituït.

oldColorDiff byte

Permet la diferència en el color antic per poder ampliar el to de color substituït.

newColorArgb int

Nou color ARGB valor per substituir el vell color amb.

ReplaceNonTransparentColors(Color)

Reemplaça tots els colors no transparents amb un nou color i conserva el valor alfa original per tal d’emmagatzemar extrems suaves.Nota: si la utilitzeu en imatges sense transparència, tots els colors seran substituïts per un únic.

public void ReplaceNonTransparentColors(Color newColor)

Parameters

newColor Color

Un nou color per substituir els colors no transparents.

ReplaceNonTransparentColors(Int)

Reemplaça tots els colors no transparents amb un nou color i conserva el valor alfa original per tal d’emmagatzemar extrems suaves.Nota: si la utilitzeu en imatges sense transparència, tots els colors seran substituïts per un únic.

public virtual void ReplaceNonTransparentColors(int newColorArgb)

Parameters

newColorArgb int

Nou valor de color ARGB per substituir els colors no transparents amb.

Resize(Int, int, ImageResizeSettings)

Recupera la imatge amb opcions ampliades.

public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)

Parameters

newWidth int

La nova amplada.

newHeight int

La nova alçada.

settings ImageResizeSettings

La restauració de les instal·lacions.

Examples

Aquest exemple carrega una imatge de raster i la resisa utilitzant diverses configuracions de resissió.

string dir = "c:\\temp\\";

                                                                                            Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();

                                                                                            // The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
                                                                                            resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;

                                                                                            // The small rectangular filter
                                                                                            resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;

                                                                                            // The number of colors in the palette.
                                                                                            resizeSettings.EntriesCount = 256;

                                                                                            // The color quantization is not used
                                                                                            resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;

                                                                                            // The euclidian method
                                                                                            resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;

                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
                                                                                            {
                                                                                                // Scale down by 2 times using adaptive resampling.
                                                                                                image.Resize(image.Width / 2, image.Height / 2, resizeSettings);
                                                                                                image.Save(dir + "downsample.adaptive.gif");
                                                                                            }

Rotate(Float, bool i color)

Rotació de la imatge al voltant del centre.

public virtual void Rotate(float angle, bool resizeProportionally, Color backgroundColor)

Parameters

angle float

L’angle de rotació en graus. els valors positius giraran de manera horària.

resizeProportionally bool

si s’estableix a ’true’ haurà canviat la mida de la imatge d’acord amb les projeccions rectangles (punts de cor) girats en un altre cas que deixen les dimensions sense tocar i només els continguts de l’imatge intern es giren.

backgroundColor Color

El color del fons.

Exceptions

NotImplementedException

Excepció no aplicada

Rotate(Float)

Rotació de la imatge al voltant del centre.

public override void Rotate(float angle)

Parameters

angle float

L’angle de rotació en graus. els valors positius giraran de manera horària.

Save(Flux, ImageOptionsBase, Rectangle)

Salva les dades de la imatge al flux especificat en el format de fitxers especificats segons les opcions d’emmagatzematge.

public override void Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)

Parameters

stream Stream

El flux per salvar les dades de la imatge a.

optionsBase ImageOptionsBase

Les opcions d’estalvi.

boundsRectangle Rectangle

L’imatge de destinació limita el rectangle. Establir el recte buit per utilitzar els límits de font.

SaveArgb32Pixels(El recte, int[])

Es conserven els píxels ARGB de 32 bits.

public void SaveArgb32Pixels(Rectangle rectangle, int[] pixels)

Parameters

rectangle Rectangle

El rectangle per salvar píxels a.

pixels int []

El 32-bit ARGB píxels arreu.

Examples

L’exemple següent omple l’àrea central d’una imatge de raster amb píxels negres utilitzant el mètode Aspose.Imaging.RasterImage.SaveArgb32Pixels.

string dir = "c:\\temp\\";

                                                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                         {
                                                                                                                                                             Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                             // The black square
                                                                                                                                                             int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
                                                                                                                                                             for (int i = 0; i &lt; pixels.Length; i++)
                                                                                                                                                             {
                                                                                                                                                                 pixels[i] = Color.Black.ToArgb();
                                                                                                                                                             }

                                                                                                                                                             // Draw the black square at the center of the image.
                                                                                                                                                             Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
                                                                                                                                                             rasterImage.SaveArgb32Pixels(area, pixels);

                                                                                                                                                             rasterImage.Save(dir + "sample.SaveArgb32Pixels.png");
                                                                                                                                                         }

SaveCmyk32Pixels(El recte, int[])

Conservar els píxels.

public void SaveCmyk32Pixels(Rectangle rectangle, int[] pixels)

Parameters

rectangle Rectangle

El rectangle per salvar píxels a.

pixels int []

Els píxels CMYK es presenten com els valors integrals de 32 bits.

Examples

L’exemple següent omple l’àrea central d’una imatge de raster amb píxels negres utilitzant el mètode Aspose.Imaging.RasterImage.SaveCmyk32Pixels.

string dir = @"c:\temp\";

                                                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                         {
                                                                                                                                                             Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                             // Get an integer representation of black in the CMYK color space.
                                                                                                                                                             int blackCmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(Color.Black);

                                                                                                                                                             // The black square.
                                                                                                                                                             int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
                                                                                                                                                             for (int i = 0; i &lt; pixels.Length; i++)
                                                                                                                                                             {
                                                                                                                                                                 pixels[i] = blackCmyk;
                                                                                                                                                             }

                                                                                                                                                             // Draw the black square at the center of the image.
                                                                                                                                                             Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
                                                                                                                                                             rasterImage.SaveCmyk32Pixels(area, pixels);

                                                                                                                                                             rasterImage.Save(dir + "sample.SaveCmyk32Pixels.png");
                                                                                                                                                         }

SaveCmykPixels(Rectangle i CmykColor[])

Conservar els píxels.Si us plau, utilitzeu més eficaç el mètode Aspose.Imaging.RasterImage.SaveCmyk32Pixels(__W L17_Rectangle,System.Int32[]).

[Obsolete("Method is obsolete")]
public void SaveCmykPixels(Rectangle rectangle, CmykColor[] pixels)

Parameters

rectangle Rectangle

El rectangle per salvar píxels a.

pixels CmykColor []

Els píxels CMYK s’arreglen.

SavePixels(Rectangle, color[])

Conservar els píxels.

public void SavePixels(Rectangle rectangle, Color[] pixels)

Parameters

rectangle Rectangle

El rectangle per salvar píxels a.

pixels Color []

Els píxels s’enfonen.

Examples

L’exemple següent omple l’àrea central d’una imatge de raster amb píxels negres utilitzant el mètode Aspose.Imaging.RasterImage.SavePixels.

string dir = "c:\\temp\\";

                                                                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                                                                       // The black square
                                                                                                                                                       Color[] pixels = new Color[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
                                                                                                                                                       for (int i = 0; i &lt; pixels.Length; i++)
                                                                                                                                                       {
                                                                                                                                                           pixels[i] = Color.Black;
                                                                                                                                                       }

                                                                                                                                                       // Draw the black square at the center of the image.
                                                                                                                                                       Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
                                                                                                                                                       rasterImage.SavePixels(area, pixels);

                                                                                                                                                       rasterImage.Save(dir + "sample.SavePixels.png");
                                                                                                                                                   }

Aquest exemple mostra com carregar la informació de Pixel en un arreu de tipus de color, manipula l’arreu i la posa de nou a la imatge.Per realitzar aquestes operacions, aquest exemple crea un nou fitxer d’imatge (en format GIF) uisng Object MemoryStream.

//Create an instance of MemoryStream
                                                                                                                                                                                                                                                         using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                                                                                                                                                                                                                                                         {
                                                                                                                                                                                                                                                             //Create an instance of GifOptions and set its various properties including the Source property
                                                                                                                                                                                                                                                             Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
                                                                                                                                                                                                                                                             gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

                                                                                                                                                                                                                                                             //Create an instance of Image
                                                                                                                                                                                                                                                             using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 //Get the pixels of image by specifying the area as image boundary
                                                                                                                                                                                                                                                                 Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);

                                                                                                                                                                                                                                                                 //Loop over the Array and sets color of alrenative indexed pixel
                                                                                                                                                                                                                                                                 for (int index = 0; index &lt; pixels.Length; index++)
                                                                                                                                                                                                                                                                 {
                                                                                                                                                                                                                                                                     if (index % 2 == 0)
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to yellow
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Yellow;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                     {
                                                                                                                                                                                                                                                                         //Set the indexed pixel color to blue
                                                                                                                                                                                                                                                                         pixels[index] = Aspose.Imaging.Color.Blue;
                                                                                                                                                                                                                                                                     }
                                                                                                                                                                                                                                                                 }

                                                                                                                                                                                                                                                                 //Apply the pixel changes to the image
                                                                                                                                                                                                                                                                 image.SavePixels(image.Bounds, pixels);

                                                                                                                                                                                                                                                                 // save all changes.
                                                                                                                                                                                                                                                                 image.Save();
                                                                                                                                                                                                                                                             }

                                                                                                                                                                                                                                                             // Write MemoryStream to File
                                                                                                                                                                                                                                                             using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                 stream.WriteTo(fileStream);
                                                                                                                                                                                                                                                             }   
                                                                                                                                                                                                                                                         }

SaveRawData(El byte[], int, Rectangle, RawDataSettings)

Estalvia les dades greus.

public void SaveRawData(byte[] data, int dataOffset, Rectangle rectangle, RawDataSettings rawDataSettings)

Parameters

data byte []

Les dades greus.

dataOffset int

Les dades primeres inicials es descompenen.

rectangle Rectangle

El rectangle de les dades greus.

rawDataSettings RawDataSettings

Les dades greus s’estableixen les dades que hi ha.

SetArgb32Pixel(Int, int, int)

Estableix un píxel ARGB de imatge de 32 bits per a la posició especificada.

public void SetArgb32Pixel(int x, int y, int argb32Color)

Parameters

x int

La posició del pixel x.

y int

El pixel i la ubicació.

argb32Color int

El píxel ARGB de 32 bits per a la posició especificada.

Examples

L’exemple següent carrega una imatge de raster, i fixa el color d’un pixel arbitràri.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                    // Sets the color of the top-left pixel.
                                                                                                    rasterImage.SetArgb32Pixel(0, 0, Aspose.Imaging.Color.Aqua.ToArgb());

                                                                                                    // Another way is to pass an instance of the Aspose.Imaging.Color directly
                                                                                                    rasterImage.SetPixel(0, 0, Aspose.Imaging.Color.Aqua);
                                                                                                }

SetPalette(Col·lecció, Bool)

Posa la paleta d’imatge.

public override void SetPalette(IColorPalette palette, bool updateColors)

Parameters

palette IColorPalette

La paleta s’ha de fixar.

updateColors bool

si s’estableix a “verd” colors es actualitzarà d’acord amb la nova paleta; en cas contrari, els índexs de color romandran inalterats.

SetPixel(Int, int, color)

Establir un píxel d’imatge per a la posició especificada.

public void SetPixel(int x, int y, Color color)

Parameters

x int

La posició del pixel x.

y int

El pixel i la ubicació.

color Color

El color del pixel per a la posició especificada.

Examples

L’exemple següent carrega una imatge de raster, i fixa el color d’un pixel arbitràri.

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                    // Sets the color of the top-left pixel.
                                                                                                    rasterImage.SetArgb32Pixel(0, 0, Aspose.Imaging.Color.Aqua.ToArgb());

                                                                                                    // Another way is to pass an instance of the Aspose.Imaging.Color directly
                                                                                                    rasterImage.SetPixel(0, 0, Aspose.Imaging.Color.Aqua);
                                                                                                }

SetResolution(doble, doble)

Estableix la resolució per a aquest Aspose.Imaging.RasterImage.

public virtual void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

La resolució horitzontal, en punts per polz, de la Aspose.Imaging.RasterImage.

dpiY double

La resolució vertical, en punts per polz, de la Aspose.Imaging.RasterImage.

Examples

L’exemple següent mostra com configurar la resolució horitzontal/vertical d’una imatge de raster.

string dir = "c:\\temp\\";

                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                   {
                                                                                                       Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

                                                                                                       // Get horizontal and vertical resolution of the image
                                                                                                       double horizontalResolution = rasterImage.HorizontalResolution;
                                                                                                       double verticalResolution = rasterImage.VerticalResolution;
                                                                                                       System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
                                                                                                       System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);

                                                                                                       if (horizontalResolution != 96.0 || verticalResolution != 96.0)
                                                                                                       {
                                                                                                           // Use the SetResolution method for updating both resolution values in a single call.
                                                                                                           System.Console.WriteLine("Set resolution values to 96 dpi");
                                                                                                           rasterImage.SetResolution(96.0, 96.0);

                                                                                                           System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
                                                                                                           System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
                                                                                                       }

                                                                                                       // The output may look like this:
                                                                                                       // The horizontal resolution, in pixels per inch: 300
                                                                                                       // The vertical resolution, in pixels per inch: 300
                                                                                                       // Set resolution values to 96 dpi
                                                                                                       // The horizontal resolution, in pixels per inch: 96
                                                                                                       // The vertical resolution, in pixels per inch: 96
                                                                                                   }

ToBitmap()

Converteix la imatge de raster a la bitmap.Aquest mètode no es dóna suport en versions de .Net7.0 o més altes

public virtual Bitmap ToBitmap()

Returns

Bitmap

El bitmap

UpdateDimensions(Int, Int)

Actualitza les dimensions de la imatge.

protected abstract void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

La nova imatge d’amplada.

newHeight int

Alçada de la nova imatge.

UpdateMetadata()

Actualitza els metadats de la imatge.

protected virtual void UpdateMetadata()

WriteArgb32ScanLine(Int, Int[])

Escriu tota la línia d’escaneig a l’índex de línia de scane especificada.

public void WriteArgb32ScanLine(int scanLineIndex, int[] argb32Pixels)

Parameters

scanLineIndex int

Índex basat en zero de la línia d’escaneig.

argb32Pixels int []

Els colors ARGB de 32 bits s’han d’escriure.

WriteScanLine(El color, el color[])

Escriu tota la línia d’escaneig a l’índex de línia de scane especificada.

public void WriteScanLine(int scanLineIndex, Color[] pixels)

Parameters

scanLineIndex int

Índex basat en zero de la línia d’escaneig.

pixels Color []

Els colors dels píxels s’han d’escriure.

 Català