Class RasterImage

Class RasterImage

A név: Aspose.Imaging Összefoglaló: Aspose.Imaging.dll (25.4.0)

A raster kép támogatja a raster grafikai műveleteket.

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

Örökletes tagok

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

Ez a példa azt mutatja, hogyan kell feltölteni a Pixel információt egy Type Color Array, manipulálja a array és helyezze vissza a képet. Ahhoz, hogy ezeket a műveleteket, ez a példány hoz létre egy új Image fájlt (GIF formátumban) uisng MemoryStream objektum.

//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()

Kezdődik a Aspose.Imaging.RasterImage osztály új példája.

[JsonConstructor]
protected RasterImage()

RasterImage(Színes paletták)

Kezdődik a Aspose.Imaging.RasterImage osztály új példája.

protected RasterImage(IColorPalette colorPalette)

Parameters

colorPalette IColorPalette

A szín palettája.

Fields

xmpDátum

Az XMP metadata

[JsonProperty]
protected XmpPacketWrapper xmpData

mező értéke

XmpPacketWrapper

Properties

DataLoader

Megkapja vagy beállítja az adattöltőt.

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

ingatlan értéke

IRasterImageArgb32PixelLoader

HasAlpha

Megkap egy értéket, amely azt jelzi, hogy ez az eset alfa.

public virtual bool HasAlpha { get; }

ingatlan értéke

bool

Examples

A következő példa feltölti a raster képeket és nyomtat információkat a nyers adatformátum és az alfa csatorna.

// 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

Az alábbi példa azt mutatja, hogyan lehet kivonni az információt a nyers adatformátum és az alfa csatorna egy BMP kép.

// 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

Megkap egy értéket, amely azt jelzi, hogy a kép átlátszó színű-e.

public virtual bool HasTransparentColor { get; set; }

ingatlan értéke

bool

HorizontalResolution

Megkapja vagy beállítja az ezen Aspose.Imaging.RasterImage horizontális felbontását, pixelek per hüvelykben.

public virtual double HorizontalResolution { get; set; }

ingatlan értéke

double

Examples

Az alábbi példa azt mutatja, hogyan kell beállítani a horizontális / függőleges felbontást egy raster kép.

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

Alapértelmezés szerint ezt az értéket mindig 96 jelenti, mivel a különböző platformok nem tudják visszaadni a képernyő felbontását.

ImageOpacity

Ennek a képnek az opacitása van.

public virtual float ImageOpacity { get; }

ingatlan értéke

float

IsRawDataAvailable

Megkap egy értéket, amely jelzi, hogy rendelkezésre áll-e nyers adattöltés.

public bool IsRawDataAvailable { get; }

ingatlan értéke

bool

PremultiplyComponents

Megkapja vagy beállítja azt a értéket, amely azt jelzi, hogy a képkomponenseket meg kell-e többszörözni.

public virtual bool PremultiplyComponents { get; set; }

ingatlan értéke

bool

Examples

A következő példa létrehoz egy új raster képet, mentse a megadott fél átlátszó pixeleket, majd feltölti ezeket a pixelt, és megkapja a végső színeket az előzetes formában.

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

Megkapja vagy beállítja a beállított színkonvertert

public IColorConverter RawCustomColorConverter { get; set; }

ingatlan értéke

IColorConverter

RawDataFormat

Megkapja a nyers adatformátumot.

public virtual PixelDataFormat RawDataFormat { get; }

ingatlan értéke

PixelDataFormat

Examples

A következő példa feltölti a raster képeket és nyomtat információkat a nyers adatformátum és az alfa csatorna.

// 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

Ez a példa azt mutatja, hogyan kell feltölteni egy DJVU képet egy fájl áramlásától és nyomtatni az oldalakról szóló információkat.

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

Megkapja a jelenlegi nyers adatok beállításait. jegyezze meg, ha ezeket a beállításokat használja, az adatok átalakítás nélkül kerülnek feltöltésre.

[JsonIgnore]
public RawDataSettings RawDataSettings { get; }

ingatlan értéke

RawDataSettings

RawFallbackIndex

Megkapja vagy beállítja a Fallback Index használatát, amikor a palett index a határokon kívül van

public int RawFallbackIndex { get; set; }

ingatlan értéke

int

RawIndexedColorConverter

Megkapja vagy beállítja az indexelt színváltót

public IIndexedColorConverter RawIndexedColorConverter { get; set; }

ingatlan értéke

IIndexedColorConverter

RawLineSize

Megkapja a nyers vonal méretét bajtokban.

public virtual int RawLineSize { get; }

ingatlan értéke

int

TransparentColor

A kép átlátszó színű.

public virtual Color TransparentColor { get; set; }

ingatlan értéke

Color

UpdateXmpData

Megkapja vagy beállít egy értéket, amely azt jelzi, hogy frissíteni kell-e az XMP metadatait.

public virtual bool UpdateXmpData { get; set; }

ingatlan értéke

bool

UsePalette

Megkap egy értéket, amely jelzi, hogy a képpalettát használják-e.

public override bool UsePalette { get; }

ingatlan értéke

bool

UseRawData

Megkapja vagy beállítja azt a értéket, amely azt jelzi, hogy használja-e a nyers adatterhelést, amikor a nyers adatterhelés elérhető.

public virtual bool UseRawData { get; set; }

ingatlan értéke

bool

VerticalResolution

Megkapja vagy beállítja a függőleges felbontást, pixelek per hüvelyk, a Aspose.Imaging.RasterImage.

public virtual double VerticalResolution { get; set; }

ingatlan értéke

double

Examples

Az alábbi példa azt mutatja, hogyan kell beállítani a horizontális / függőleges felbontást egy raster kép.

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

Alapértelmezés szerint ezt az értéket mindig 96 jelenti, mivel a különböző platformok nem tudják visszaadni a képernyő felbontását.

XmpData

Megkapja vagy beállítja az XMP metadatait.

public virtual XmpPacketWrapper XmpData { get; set; }

ingatlan értéke

XmpPacketWrapper

Methods

AdjustBrightness(int)

A fényesség beállítása a képhez.

public virtual void AdjustBrightness(int brightness)

Parameters

brightness int

A fény értéke.

Examples

A következő példa egy kép fényességének korrekcióját végzi.

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(Flotta)

kép kontraszt

public virtual void AdjustContrast(float contrast)

Parameters

contrast float

A kontraszt értéke (tartományban [-100; 100])

Examples

A következő példa egy kép kontraszt korrekcióját végzi.

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(hajó, hajó, hajó)

Gamma korrekció egy képet.

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

Parameters

gammaRed float

Gamma a vörös csatorna koefficienshez

gammaGreen float

Gamma a zöld csatorna koefficienshez

gammaBlue float

Gamma a kék csatorna koefficienshez

Examples

A következő példa egy kép gamma-javítását végzi, amely különböző koefficienseket alkalmaz a színkomponensekhez.

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(Flotta)

Gamma korrekció egy képet.

public virtual void AdjustGamma(float gamma)

Parameters

gamma float

Gamma a vörös, zöld és kék csatornák koefficiens

Examples

A következő példa egy kép gamma-javítását végzi.

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(kettős)

A kép binarizálása a Bradley adaptív küszöbérték algoritmusával az integrált kép küszöbértékével

public virtual void BinarizeBradley(double brightnessDifference)

Parameters

brightnessDifference double

A fénykülönbség a pixel és az átlagos s x s ablak pixelek középpontjában ez a pixel.

BinarizeBradley(kettős, int)

A kép binarizálása a Bradley adaptív küszöbérték algoritmusával az integrált kép küszöbértékével

public virtual void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

A fénykülönbség a pixel és az átlagos s x s ablak pixelek középpontjában ez a pixel.

windowSize int

A s x s ablak mérete a pixel körül összpontosított

Examples

A következő példa binarizálja a raster képet a Bradley adaptív határidős algoritmussal a meghatározott ablak méretével.

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(Byte)

Binarizáció egy előre meghatározott küszöbvel rendelkező kép

public virtual void BinarizeFixed(byte threshold)

Parameters

threshold byte

Ha egy pixel megfelelő szürke értéke meghaladja a küszöböt, 255 értéket adnak hozzá, 0 másképp.

Examples

A következő példa binarizálja a raster képet az előre meghatározott küszöbvelővel. bináris képek csak 2 színt tartalmaznak - fekete és fehér.

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()

A kép binarizálása Otsu határtartalommal

public virtual void BinarizeOtsu()

Examples

A következő példa binarizálja a raster képet Otsu határtartalommal. bináris képek csak 2 színt tartalmaznak - fekete és fehér.

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(Pont, RasterImage, Rectangle, byte)

Keverjük össze ezt a kép példáját a overlay’ képgel.

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

Parameters

origin Point

A háttérkép keverő eredetű.

overlay RasterImage

A túlnyomó kép.

overlayArea Rectangle

A túlterhelés területén.

overlayAlpha byte

Az alfa felbontása.

Blend(Pont, RasterImage és byte)

Keverjük össze ezt a kép példáját a overlay’ képgel.

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

Parameters

origin Point

A háttérkép keverő eredetű.

overlay RasterImage

A túlnyomó kép.

overlayAlpha byte

Az alfa felbontása.

Dither(A módszer, az int)

A jelenlegi képet illusztrálja.

public void Dither(DitheringMethod ditheringMethod, int bitsCount)

Parameters

ditheringMethod DitheringMethod

Az eltávolító módszer.

bitsCount int

Az utolsó bitek számolnak a ditheringre.

Examples

A következő példa feltölti a raster képet, és különböző palettás mélységgel végzi a küszöböt és az áramlást.

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(DitheringMethod, int, IColorPalette)

A jelenlegi képet illusztrálja.

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

Parameters

ditheringMethod DitheringMethod

Az eltávolító módszer.

bitsCount int

Az utolsó bitek számolnak a ditheringre.

customPalette IColorPalette

A Dithering számára használt paletták.

Filter(Rectangle, FilterOptionsBázis)

A kijelölt rektangulát szűrjük.

public virtual void Filter(Rectangle rectangle, FilterOptionsBase options)

Parameters

rectangle Rectangle

A rektangulát.

options FilterOptionsBase

Az opciók.

Examples

A következő példa a különböző típusú szűrőket alkalmazza a raster képre.

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(Az int, int)

A kép egy 32 bites ARGB pixel.

public int GetArgb32Pixel(int x, int y)

Parameters

x int

A pixel x helye.

y int

A pixel és a hely.

Returns

int

A 32 bites ARGB pixel a kijelölt helyhez.

Examples

A következő példa feltölti a raster képet, és megkapja az önkényes pixel színét, amelyet egy 32 bites teljes értékként képvisel.

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);
                                                                                                                                        }

A következő példa azt mutatja, hogy a kép caching hogyan befolyásolja a teljesítményt. Általában a cache adatok olvasása gyorsabban történik, mint a non-cache adatokat olvasni.

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)

Megkapja az alapértelmezett 32 bites ARGB pixel sorrendjét.

public int[] GetDefaultArgb32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

A rektangul, hogy megkapja a pixelek.

Returns

int []

Az alapértelmezett pixelek array.

GetDefaultPixels(Rectangle és IPartialArgb32PixelLoader)

Megkapja az alapértelmezett pixeleket a részleges pixel töltő használatával.

public void GetDefaultPixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

A rektangul, hogy megkapja a pixelek.

partialPixelLoader IPartialArgb32PixelLoader

A részleges pixel töltő.

GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings)

Megkapja az alapértelmezett nyers adatsorozatot részleges pixel töltővel.

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

Parameters

rectangle Rectangle

A rektangul, hogy megkapja a pixelek.

partialRawDataLoader IPartialRawDataLoader

A részleges nyers adattöltő.

rawDataSettings RawDataSettings

A nyers adatok beállítása.

GetDefaultRawData(Rectangle és RawDataSettings)

Megkapja az alapértelmezett nyers adatokat.

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

Parameters

rectangle Rectangle

A rektangul, hogy nyers adatokat kapjon.

rawDataSettings RawDataSettings

A nyers adatok beállítása.

Returns

byte []

Az alapértelmezett nyers adathordozó.

GetModifyDate(Bóli)

Megkapja a dátumot és az időt, amikor az erőforrás képet utoljára módosították.

public virtual DateTime GetModifyDate(bool useDefault)

Parameters

useDefault bool

ha „igaz” beállítva használja a FileInfo-ból származó információt alapértelmezett értésként.

Returns

DateTime

A dátum és az idő az erőforrás képet utoljára módosították.

GetPixel(Az int, int)

Megkap egy kép pixel.

public Color GetPixel(int x, int y)

Parameters

x int

A pixel x helye.

y int

A pixel és a hely.

Returns

Color

A pixel színe a meghatározott helyhez.

Examples

A következő példa feltölti a raster képet, és megkapja az önkényes pixel színét.

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()

Megkapja a csúszás szögét.Ez a módszer alkalmazható a szkennelt szöveges dokumentumokra, hogy meghatározzák a szkennelési szöget.

public float GetSkewAngle()

Returns

float

A csúszás szögben, fokban.

Grayscale()

A kép átalakítása a grayscale reprezentációjához

public virtual void Grayscale()

Examples

A következő példa átalakítja a színes raster képet a szürke színű reprezentációjához. a Grayscale képek kizárólag szörnyű árnyalatokból állnak, és csak intenzitási információkat hordoznak.

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)

32 bites ARGB pixel.

public int[] LoadArgb32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

A rektangul, hogy töltse fel a pixeleket.

Returns

int []

A töltött 32 bites ARGB pixel array.

Examples

A következő példa azt mutatja, hogyan kell feltölteni és feldolgozni a pixelek egy raster képet. a pixeleket képviselik, mint a 32 bites integrált értékek. Például, vegye figyelembe a probléma számítása teljesen átlátszó Pixel a kép.

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)

64 bites ARGB pixel.

public long[] LoadArgb64Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

A rektangul, hogy töltse fel a pixeleket.

Returns

long []

A 64 bites ARGB pixel felbontása.

Examples

A következő példa azt mutatja, hogyan kell feltölteni és feldolgozni a pixelek egy raster képet. a pixeleket képviselik, mint a 64 bites integrált értékek. Például, vegye figyelembe a probléma számítása teljesen átlátszó Pixel a kép.

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)

A pixelek CMYK formátumban kerülnek feltöltésre.

public int[] LoadCmyk32Pixels(Rectangle rectangle)

Parameters

rectangle Rectangle

A rektangul, hogy töltse fel a pixeleket.

Returns

int []

A feltöltött CMYK pixelek 32 bites inateger értékként jelen vannak.

LoadCmykPixels(Rectangle)

A pixelek CMYK formátumban kerülnek feltöltésre.Kérjük, hatékonyabban használja a Aspose.Imaging.RasterImage.LoadCmyk32Pixels(_W L17.Rectangle) módszert.

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

Parameters

rectangle Rectangle

A rektangul, hogy töltse fel a pixeleket.

Returns

CmykColor []

A feltöltött CMYK pixel array.

LoadPartialArgb32Pixels(Rectangle és IPartialArgb32PixelLoader)

A 32 bites ARGB pixeleket részben csomagokkal tölti fel.

public void LoadPartialArgb32Pixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

A kívánt rektangulát.

partialPixelLoader IPartialArgb32PixelLoader

A 32 bites ARGB pixel töltő.

Examples

A következő példa azt mutatja, hogyan kell feltölteni és feldolgozni a pixeleket egy raster kép segítségével a saját részleges processzor. Például, vegye figyelembe a probléma számítását teljesen átlátszó pixelek egy kép. Annak érdekében, hogy számítani a transparent pixels használatával részes töltési mechanizmus, egy külön osztály TransparentArgb32PixelCounter végrehajtása Aspose.Imaging.IPartialArGB32PixelLoader bevezetett.

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 és IPartialArgb64PixelLoader)

A 64 bites ARGB pixeleket részben csomagokkal tölti fel.

public void LoadPartialArgb64Pixels(Rectangle rectangle, IPartialArgb64PixelLoader partialPixelLoader)

Parameters

rectangle Rectangle

A kívánt rektangulát.

partialPixelLoader IPartialArgb64PixelLoader

A 64 bites ARGB pixel töltő.

LoadPartialPixels(Rectangle és IPartialPixelLoader)

A pixeleket részben csomagokkal töltjük fel.

public void LoadPartialPixels(Rectangle desiredRectangle, IPartialPixelLoader pixelLoader)

Parameters

desiredRectangle Rectangle

A kívánt rektangulát.

pixelLoader IPartialPixelLoader

A pixel töltő.

Examples

A következő példa azt mutatja, hogyan kell feltölteni és feldolgozni a pixeleket egy raster kép segítségével a saját részleges processzor. Például, vegye figyelembe a probléma számítását teljesen átlátszó pixelek egy kép. Annak érdekében, hogy számolni áttekinthető használatával részes feltöltő mechanizmus, egy külön osztály TransparentPixelCounter végrehajtása Aspose.Imaging.IPartialPixelLoader kerül bevezetésre.

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)

Töltse fel a pixeleket.

public Color[] LoadPixels(Rectangle rectangle)

Parameters

rectangle Rectangle

A rektangul, hogy töltse fel a pixeleket.

Returns

Color []

A beágyazott pixelek elhelyezkedése.

Examples

A következő példa azt mutatja, hogyan kell feltölteni és feldolgozni a pixeleket egy raster kép. Például, vegye figyelembe a probléma számítása teljesen átlátszó pixelek egy képet.

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);
                                                                                                                                                                             }

Ez a példa azt mutatja, hogyan kell feltölteni a Pixel információt egy Type Color Array, manipulálja a array és helyezze vissza a képet. Ahhoz, hogy ezeket a műveleteket, ez a példány hoz létre egy új Image fájlt (GIF formátumban) uisng MemoryStream objektum.

//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, IPartialRawDataLoader)

A nyers adatok feltöltése.

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

Parameters

rectangle Rectangle

A rektangul a nyers adatok feltöltése.

rawDataSettings RawDataSettings

A feltöltött adatokra használt nyers adatok beállításai. Megjegyzés: ha az adatok nem a megadott formátumban vannak, akkor az adatok átalakítása elvégezhető.

rawDataLoader IPartialRawDataLoader

A nyers adathordozó.

Examples

A következő példa azt mutatja, hogyan lehet kivonni a pixeleket a nyers képadatokból a RawDataSettings használatával. Például, vegye figyelembe a kép teljesen átlátszó pixelek számításának problémáját.

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, Rectangle, RawDataSettings, IPartialRawDataLoader)

A nyers adatok feltöltése.

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

Parameters

rectangle Rectangle

A rektangul a nyers adatok feltöltése.

destImageBounds Rectangle

Az illusztráció korlátozódik.

rawDataSettings RawDataSettings

A feltöltött adatokra használt nyers adatok beállításai. Megjegyzés: ha az adatok nem a megadott formátumban vannak, akkor az adatok átalakítása elvégezhető.

rawDataLoader IPartialRawDataLoader

A nyers adathordozó.

NormalizeAngle()

Normalizálja a szöget.Ez a módszer alkalmazható a szkennelt szöveges dokumentumokra, hogy megszabaduljanak a szkennelt szkenneltől.Ez a módszer használja a Aspose.Imaging.RasterImage.GetSkewAngle és a W L17.Megoldó.System.Single módszert.

public void NormalizeAngle()

NormalizeAngle(Bool, Szín)

Normalizálja a szöget.Ez a módszer alkalmazható a szkennelt szöveges dokumentumokra, hogy megszabaduljanak a szkennelt szkenneltől.Ez a módszer használja a Aspose.Imaging.RasterImage.GetSkewAngle és a W L17. RasterImex.Roate(System.Single,Sistem.Boolean,Wl17__.Color) módszert.

public virtual void NormalizeAngle(bool resizeProportionally, Color backgroundColor)

Parameters

resizeProportionally bool

ha „igaznak” van beállítva, akkor a kép mérete a forgatott rektangul (szögpont) projekciók szerint változik, más esetben a dimenziókat érintetlenül hagyja, és csak a belső kép tartalmát forgatják.

backgroundColor Color

A háttér színe.

Examples

Skew egy műszer, amely megjelenhet a dokumentum szkennelési folyamat során, amikor a szöveg / képek a Dokumentum egy enyhe szögben forog. Ez lehet különböző okok, de a leggyakoribb, hogy a papír rossz helyen történik a szkenner során. ezért, deskev a folyamat kimutatása és kijavítása ez a probléma a skannált fájlokat (azaz bitmapp), így a diszkeved anyagok lesz a szöveget/képeket helyesen és horizontálisan módosított.

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()

Normalizálja a kép histogramát - a pixel értékeket az összes rendelkezésre álló tartomány használatához igazítja.

public virtual void NormalizeHistogram()

ReadArgb32ScanLine(int)

Olvassa el az egész szkennelési vonalat a kijelölt szkennelési vonal indexével.

public int[] ReadArgb32ScanLine(int scanLineIndex)

Parameters

scanLineIndex int

Nullalapú index a szkennelési vonal.

Returns

int []

A szkennelési vonal 32 bites ARGB színértékeket sorol.

ReadScanLine(int)

Olvassa el az egész szkennelési vonalat a kijelölt szkennelési vonal indexével.

public Color[] ReadScanLine(int scanLineIndex)

Parameters

scanLineIndex int

Nullalapú index a szkennelési vonal.

Returns

Color []

A szkennelési vonal pixel színértékek sorrendben.

ReleaseManagedResources()

Győződjön meg róla, hogy a kezelt erőforrások nem kerülnek kiadásra itt, mivel lehet, hogy már kiadásra kerültek.

protected override void ReleaseManagedResources()

RemoveMetadata()

Távolítsa el ezt a kép példájának metadatait azáltal, hogy ez a Aspose.Imaging.Xmp.IHasxmpData. Null.

public override void RemoveMetadata()

ReplaceColor(Szín, byte és szín)

Az egyik színt a másikhoz helyettesíti a megengedett különbséggel, és megőrzi az eredeti alfa értéket a sima szélességek mentése érdekében.

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

Parameters

oldColor Color

A régi színt helyettesítik.

oldColorDiff byte

Megengedett különbség a régi szín, hogy képes legyen kiterjeszteni a helyettesített színt.

newColor Color

Új szín, hogy helyettesítse a régi színt.

ReplaceColor(Az int, byte, int)

Az egyik színt a másikhoz helyettesíti a megengedett különbséggel, és megőrzi az eredeti alfa értéket a sima szélességek mentése érdekében.

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

Parameters

oldColorArgb int

A régi szín ARGB értéket helyettesíteni kell.

oldColorDiff byte

Megengedett különbség a régi szín, hogy képes legyen kiterjeszteni a helyettesített színt.

newColorArgb int

Új szín ARGB érték, hogy helyettesítse a régi szín.

ReplaceNonTransparentColors(Color)

A nem átlátszó színeket új színekkel helyettesíti, és megőrzi az eredeti alfa értéket a sima szélességek mentése érdekében.Megjegyzés: Ha az átláthatóság nélküli képeken használja, az összes színt egyetlen színrel helyettesítik.

public void ReplaceNonTransparentColors(Color newColor)

Parameters

newColor Color

Új színek a nem átlátszó színek helyettesítésére.

ReplaceNonTransparentColors(int)

A nem átlátszó színeket új színekkel helyettesíti, és megőrzi az eredeti alfa értéket a sima szélességek mentése érdekében.Megjegyzés: Ha az átláthatóság nélküli képeken használja, az összes színt egyetlen színrel helyettesítik.

public virtual void ReplaceNonTransparentColors(int newColorArgb)

Parameters

newColorArgb int

Új szín ARGB értéket helyettesíteni nem átlátszó színek.

Resize(int, int, ImageResizeSettings)

A képet kiterjesztett opciókkal helyreállítja.

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

Parameters

newWidth int

Az új szélesség.

newHeight int

Az új magasság.

settings ImageResizeSettings

A helyreállítási beállítások.

Examples

Ez a példa feltölti a raster képet, és a különböző resizing beállítások segítségével újrahasznosítja.

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, Szín)

Kerülje a képet a központ körül.

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

Parameters

angle float

A fordulati szög fokban. pozitív értékek fordulnak órásan.

resizeProportionally bool

ha „igaznak” van beállítva, akkor a kép mérete a forgatott rektangul (szögpont) projekciók szerint változik, más esetben a dimenziókat érintetlenül hagyja, és csak a belső kép tartalmát forgatják.

backgroundColor Color

A háttér színe.

Exceptions

NotImplementedException

Nem végrehajtott kivétel

Rotate(Flotta)

Kerülje a képet a központ körül.

public override void Rotate(float angle)

Parameters

angle float

A fordulati szög fokban. pozitív értékek fordulnak órásan.

Save(Áramlat, ImageOptionsBase, Rectangle)

Megtakarítja a kép adatait a megadott áramlásra a megadott fájlformátumban a megtakarítási lehetőségek szerint.

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

Parameters

stream Stream

Az áram, hogy mentse a kép adatait.

optionsBase ImageOptionsBase

A megtakarítási lehetőségek.

boundsRectangle Rectangle

A célkép korlátozza a jobboldalt. Állítsa be az üres jobboldalt a forrás határainak használatához.

SaveArgb32Pixels(Székesfehérvár, int[])

Megtakarítja a 32 bites ARGB pixeleket.

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

Parameters

rectangle Rectangle

A rektangul, hogy mentse a pixeleket.

pixels int []

A 32 bites ARGB pixel.

Examples

A következő példa a raster kép központi területeit fekete pixelekkel tölti be a Aspose.Imaging.RasterImage.SaveArgb32Pixels módszerrel.

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(Székesfehérvár, int[])

Megtakarítja a pixeleket.

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

Parameters

rectangle Rectangle

A rektangul, hogy mentse a pixeleket.

pixels int []

A CMYK pixeleket a 32 bites integrált értékként mutatják be.

Examples

A következő példa a raster kép központi területeit fekete pixelekkel tölti be a Aspose.Imaging.RasterImage.SaveCmyk32Pixels módszerrel.

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 és CmykColor[])

Megtakarítja a pixeleket.Kérjük, hatékonyabban használja a Aspose.Imaging.RasterImage.SaveCmyk32Pixels(W L 17 .Rectangle,System.Int32[]) módszert.

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

Parameters

rectangle Rectangle

A rektangul, hogy mentse a pixeleket.

pixels CmykColor []

A CMYK pixelek megjelennek.

SavePixels(színes, színes[])

Megtakarítja a pixeleket.

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

Parameters

rectangle Rectangle

A rektangul, hogy mentse a pixeleket.

pixels Color []

A pixelek megjelennek.

Examples

A következő példa a raster kép központi területeit fekete pixelekkel tölti be a Aspose.Imaging.RasterImage.SavePixels módszerrel.

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");
                                                                                                                                                   }

Ez a példa azt mutatja, hogyan kell feltölteni a Pixel információt egy Type Color Array, manipulálja a array és helyezze vissza a képet. Ahhoz, hogy ezeket a műveleteket, ez a példány hoz létre egy új Image fájlt (GIF formátumban) uisng MemoryStream objektum.

//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(Byte[], int, Rectangle, RawDataSettings)

Megtakarítja a nyers adatokat.

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

Parameters

data byte []

A nyers adatok.

dataOffset int

A kezdeti nyers adatok kompenzálnak.

rectangle Rectangle

A nyers adatok rektangulája.

rawDataSettings RawDataSettings

A nyers adatok beállítása, amelyben az adatok vannak.

SetArgb32Pixel(Az int, int, int)

Hozzon létre egy 32 bites ARGB pixel képet a kijelölt pozícióhoz.

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

Parameters

x int

A pixel x helye.

y int

A pixel és a hely.

argb32Color int

A 32 bites ARGB pixel a meghatározott pozícióhoz.

Examples

A következő példa feltölti a raster képet, és beállítja az önkényes pixel színét.

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(Székesfehérvár, Bool)

Állítsa be a kép palettáját.

public override void SetPalette(IColorPalette palette, bool updateColors)

Parameters

palette IColorPalette

A palettát be kell állítani.

updateColors bool

ha a “valódi” színekre van beállítva, az új palettával összhangban frissül; különben a színindexek változatlanok maradnak.

SetPixel(int, int, színe)

Állítson be egy kép pixelet a meghatározott pozícióhoz.

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

Parameters

x int

A pixel x helye.

y int

A pixel és a hely.

color Color

A pixel színe a meghatározott pozícióhoz.

Examples

A következő példa feltölti a raster képet, és beállítja az önkényes pixel színét.

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(kettős, kettős)

Állítsa be a felbontást erre a Aspose.Imaging.RasterImage.

public virtual void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

A horizontális felbontás a Aspose.Imaging.RasterImage pontokban.

dpiY double

A függőleges felbontás, pontonként, a Aspose.Imaging.RasterImage.

Examples

Az alábbi példa azt mutatja, hogyan kell beállítani a horizontális / függőleges felbontást egy raster kép.

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()

Konvertálja a raster képet a bitmappra.Ezt a módszert nem támogatják a .Net7.0 vagy újabb verziókban

public virtual Bitmap ToBitmap()

Returns

Bitmap

A bitmap

UpdateDimensions(Az int, int)

A kép dimenzióinak frissítése.

protected abstract void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

Az új kép szélessége.

newHeight int

Az új kép magassága.

UpdateMetadata()

A kép metadatainak frissítése.

protected virtual void UpdateMetadata()

WriteArgb32ScanLine(Az int, int[])

Írja be az egész szkennelési vonalat a kijelölt szkennelési vonal indexéhez.

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

Parameters

scanLineIndex int

Nullalapú index a szkennelési vonal.

argb32Pixels int []

A 32 bites ARGB színek írhatók.

WriteScanLine(Szín, szín[])

Írja be az egész szkennelési vonalat a kijelölt szkennelési vonal indexéhez.

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

Parameters

scanLineIndex int

Nullalapú index a szkennelési vonal.

pixels Color []

A pixel színek írnak.

 Magyar