Class RasterCachedImage

Class RasterCachedImage

Le nom : Aspose.Imaging Assemblée: Aspose.Imaging.dll (25.4.0)

Rappresenta un’immagine raster che supporta le operazioni grafiche raster.Questa immagine cache i dati dei pixel quando richiesto.

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

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage

Derived

ApngFrame , AvifImage , BmpImage , DicomPage , DjvuPage , DjvuRaster , DngImage , GifFrameBlock , Jpeg2000Image , JpegImage , PngImage , RasterCachedMultipageImage , TgaImage , TiffFrame , WebPFrameBlock

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

I membri ereditari

RasterImage.xmpData , RasterImage.RemoveMetadata() , RasterImage.Save(Stream, ImageOptionsBase, Rectangle) , RasterImage.GetModifyDate(bool) , RasterImage.Dither(DitheringMethod, int) , RasterImage.Dither(DitheringMethod, int, IColorPalette) , RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) , RasterImage.GetDefaultArgb32Pixels(Rectangle) , RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) , RasterImage.GetArgb32Pixel(int, int) , RasterImage.GetPixel(int, int) , RasterImage.SetArgb32Pixel(int, int, int) , RasterImage.SetPixel(int, int, Color) , RasterImage.ReadScanLine(int) , RasterImage.ReadArgb32ScanLine(int) , RasterImage.WriteScanLine(int, Color[]) , RasterImage.WriteArgb32ScanLine(int, int[]) , RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) , RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) , RasterImage.LoadArgb32Pixels(Rectangle) , RasterImage.LoadArgb64Pixels(Rectangle) , RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) , RasterImage.LoadPixels(Rectangle) , RasterImage.LoadCmykPixels(Rectangle) , RasterImage.LoadCmyk32Pixels(Rectangle) , RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) , RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) , RasterImage.SaveArgb32Pixels(Rectangle, int[]) , RasterImage.SavePixels(Rectangle, Color[]) , RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) , RasterImage.SaveCmyk32Pixels(Rectangle, int[]) , RasterImage.SetResolution(double, double) , RasterImage.SetPalette(IColorPalette, bool) , RasterImage.Resize(int, int, ImageResizeSettings) , RasterImage.Rotate(float, bool, Color) , RasterImage.Rotate(float) , RasterImage.BinarizeFixed(byte) , RasterImage.BinarizeOtsu() , RasterImage.BinarizeBradley(double) , RasterImage.BinarizeBradley(double, int) , RasterImage.Blend(Point, RasterImage, Rectangle, byte) , RasterImage.Blend(Point, RasterImage, byte) , RasterImage.Grayscale() , RasterImage.NormalizeHistogram() , RasterImage.AdjustBrightness(int) , RasterImage.AdjustContrast(float) , RasterImage.AdjustGamma(float, float, float) , RasterImage.AdjustGamma(float) , RasterImage.GetSkewAngle() , RasterImage.NormalizeAngle() , RasterImage.NormalizeAngle(bool, Color) , RasterImage.Filter(Rectangle, FilterOptionsBase) , RasterImage.ReplaceColor(Color, byte, Color) , RasterImage.ReplaceColor(int, byte, int) , RasterImage.ReplaceNonTransparentColors(Color) , RasterImage.ReplaceNonTransparentColors(int) , RasterImage.ToBitmap() , RasterImage.ReleaseManagedResources() , RasterImage.UpdateMetadata() , RasterImage.UpdateDimensions(int, int) , RasterImage.PremultiplyComponents , RasterImage.UseRawData , RasterImage.UpdateXmpData , RasterImage.XmpData , RasterImage.RawIndexedColorConverter , RasterImage.RawCustomColorConverter , RasterImage.RawFallbackIndex , RasterImage.RawDataSettings , RasterImage.UsePalette , RasterImage.RawDataFormat , RasterImage.RawLineSize , RasterImage.IsRawDataAvailable , RasterImage.HorizontalResolution , RasterImage.VerticalResolution , RasterImage.HasTransparentColor , RasterImage.HasAlpha , RasterImage.TransparentColor , RasterImage.ImageOpacity , RasterImage.DataLoader , 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

L’exemple suivant transforme une image cachée de raster colorée à sa représentation graisseuse. les images graisses sont composées exclusivement de nuances de gris et ne portent que des informations d’intensité.

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

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

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

Constructors

RasterCachedImage()

Initialisez une nouvelle instance de la classe Aspose.Imaging.RasterCachedImage.

protected RasterCachedImage()

RasterCachedImage(L’ICOLORPALETE)

Initialisez une nouvelle instance de la classe Aspose.Imaging.RasterCachedImage.

protected RasterCachedImage(IColorPalette colorPalette)

Parameters

colorPalette IColorPalette

La paletta dei colori.

Properties

IsCached

Riceve un valore che indica se i dati dell’immagine sono cache attualmente.

public override bool IsCached { get; }

Valore di proprietà

bool

Methods

AdjustBrightness(int)

Adattare una luminosità per l’immagine.

public override void AdjustBrightness(int brightness)

Parameters

brightness int

Il valore della luminosità.

Examples

L’exemple suivant effectue une correction de luminosité d’une image cachée de raster.

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

                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                         {
                                                                                             Aspose.Imaging.RasterCachedImage rasterImage = (Aspose.Imaging.RasterCachedImage)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(Flotte)

Immagini contrasti

public override void AdjustContrast(float contrast)

Parameters

contrast float

valeur de contraste (dans la gamme [-100; 100])

Examples

L’exemple suivant effectue la correction de contraste d’une image cachée de raster.

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

                                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                       {
                                                                                           Aspose.Imaging.RasterCachedImage rasterImage = (Aspose.Imaging.RasterCachedImage)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(Flotte, Flotte et Flotte)

Correzione gamma di un’immagine.

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

Parameters

gammaRed float

Gamma per il coefficiente del canale rosso

gammaGreen float

Gamma per il coefficiente del canale verde

gammaBlue float

Gamma per il coefficiente del canale blu

Examples

L’exemple suivant effectue une correction gamma d’une image cachée de raster appliquant différents coefficients pour les composants de couleur.

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

                                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                         {
                                                                                                                                             Aspose.Imaging.RasterCachedImage rasterImage = (Aspose.Imaging.RasterCachedImage)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(Flotte)

Correzione gamma di un’immagine.

public override void AdjustGamma(float gamma)

Parameters

gamma float

Gamma per il coefficiente dei canali rosso, verde e blu

Examples

L’exemple suivant effectue une correction gamma d’une image cachée de raster.

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

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

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

BinarizeBradley(double, int)

Binarizzazione di un’immagine utilizzando l’algoritmo di soglia adattabile di Bradley utilizzando il soglia immagine integrale

public override void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

La differenza di luminosità tra il pixel e la media di una finestra s x s di pixel centrati intorno a questo pixel.

windowSize int

La dimensione della finestra s x s dei pixel centrati intorno a questo pixel

Examples

L’exemple suivant binarisera une image cachée avec l’algorithme d’adaptation de Bradley avec la taille de fenêtre spécifiée. les images binaires ne contiennent que 2 couleurs - noir et blanc.

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

                                                                                                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                                                                         {
                                                                                                                                                                                                             Aspose.Imaging.RasterCachedImage rasterImage = (Aspose.Imaging.RasterCachedImage)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");
                                                                                                                                                                                                         }

BinarizeBradley(double)

Binarizzazione di un’immagine utilizzando l’algoritmo di soglia adattabile di Bradley utilizzando il soglia immagine integrale

public override void BinarizeBradley(double brightnessDifference)

Parameters

brightnessDifference double

La differenza di luminosità tra il pixel e la media di una finestra s x s di pixel centrati intorno a questo pixel.

Examples

L’exemple suivant binarisera une image cachée avec l’algorithme d’adaptation de Bradley. les images binaires ne contiennent que 2 couleurs - noir et blanc.

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

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

                                                                                                                                                                              // Binarize the image with a brightness difference of 5. 
                                                                                                                                                                              // The brightness is a difference between a pixel and the average of an s x s window of pixels centered around this pixel.
                                                                                                                                                                              // The size of window will be calibrated automatically.
                                                                                                                                                                              rasterImage.BinarizeBradley(5);
                                                                                                                                                                              rasterImage.Save(dir + "sample.BinarizeBradley5.png");
                                                                                                                                                                          }

BinarizeFixed(Le byte)

Binarizzazione di un’immagine con soglia predefinita

public override void BinarizeFixed(byte threshold)

Parameters

threshold byte

Se il valore grigio corrispondente di un pixel è superiore al limite, un valore di 255 sarà assegnato a esso, 0 altrimenti.

Examples

L’exemple suivant binarisera une image cachée avec le seuil prédéfini. les images binaires ne contiennent que 2 couleurs - noir et blanc.

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

                                                                                                                                                         using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                                                                         {
                                                                                                                                                             Aspose.Imaging.RasterCachedImage rasterImage = (Aspose.Imaging.RasterCachedImage)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()

Binarizzazione di un’immagine con soglia Otsu

public override void BinarizeOtsu()

Examples

L’exemple suivant binarisera une image cachée avec le seuil Otsu. Les images binaires ne contiennent que 2 couleurs - noir et blanc.

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

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

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

Blend(Point, RasterImage, Rectangle, byte)

Mélangez cette image avec l’image overlay".

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

Parameters

origin Point

L’image en arrière-plan est d’origine mixte.

overlay RasterImage

L’image de l’Overlay.

overlayArea Rectangle

La zone de surchauffement.

overlayAlpha byte

L’Alpha de l’Overlay.

CacheData()

Cache les données et s’assure qu’aucun chargement de données supplémentaire ne sera effectué à partir du Aspose.Imaging.DataStreamSupporter.

public override void CacheData()

Examples

L’exemple ci-dessous montre comment le caching d’image plus rapide affecte les performances.En général, la lecture des données cachées est effectuée plus rapidement que de lire les données non cachées.

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

                                                                                                                                                                           // Load an image from a PNG file.
                                                                                                                                                                           using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)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.
                                                                                                                                                                               for (int y = 0; y < image.Height; y++)
                                                                                                                                                                               {
                                                                                                                                                                                   for (int x = 0; x < image.Width; x++)
                                                                                                                                                                                   {
                                                                                                                                                                                       int color = image.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.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)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
                                                                                                                                                                               for (int y = 0; y < image.Height; y++)
                                                                                                                                                                               {
                                                                                                                                                                                   for (int x = 0; x < image.Width; x++)
                                                                                                                                                                                   {
                                                                                                                                                                                       int color = image.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.

Crop(Rectangle)

Scopri l’immagine.

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

Il rectangolo .

Examples

L’exemple suivant crée une image cachée de raster. La zone de récolte est spécifiée via Aspose.Imaging.Rectangle.

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

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

                                                                                                                                 // Crop the image. The cropping area is the rectangular central area of the image.
                                                                                                                                 Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
                                                                                                                                 rasterImage.Crop(area);

                                                                                                                                 // Save the cropped image to PNG
                                                                                                                                 rasterImage.Save(dir + "sample.Crop.png");
                                                                                                                             }

Dither(DitheringMétode, int, IColorPalette)

Performanze che si riflettono sull’immagine attuale.

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

Parameters

ditheringMethod DitheringMethod

Il metodo di diffusione.

bitsCount int

I bit finali contano per il dithering.

customPalette IColorPalette

La paletta personalizzata per il dithering.

Grayscale()

Trasformazione di un’immagine nella sua rappresentazione grayscale

public override void Grayscale()

Examples

L’exemple suivant transforme une image cachée de raster colorée à sa représentation graisseuse. les images graisses sont composées exclusivement de nuances de gris et ne portent que des informations d’intensité.

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

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

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

NormalizeHistogram()

Normaliser l’histogramme d’image - ajuster les valeurs de pixels pour utiliser tous les champs disponibles.

public override void NormalizeHistogram()

OnCached()

Chiamato quando i dati sono cache e tutti i risorse correlati possono essere deallocati.

protected virtual void OnCached()

OnPaletteChanged(L’ICOLOR, L’ICOLOR)

Chiamato quando la paletta è cambiata.

protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette

La vecchia paletta.

newPalette IColorPalette

La nuova paletta.

Resize(int, int, resizeType)

Ristrutturare l’immagine.

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

La nuova larghezza.

newHeight int

La nuova altezza.

resizeType ResizeType

Il tipo di ritorno.

Examples

Cet exemple charge une image cachée de raster et la résise en utilisant diverses méthodes de résisation.

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

                                                                                                  using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                  {
                                                                                                      // Scale up by 2 times using Nearest Neighbour resampling.
                                                                                                      image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);                

                                                                                                      // Save to PNG with default options.
                                                                                                      image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                  }

                                                                                                  using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                  {
                                                                                                      // Scale down by 2 times using Nearest Neighbour resampling.
                                                                                                      image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);

                                                                                                      // Save to PNG with default options.
                                                                                                      image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                  }

                                                                                                  using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                  {
                                                                                                      // Scale up by 2 times using Bilinear resampling.
                                                                                                      image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                      // Save to PNG with default options.
                                                                                                      image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                  }

                                                                                                  using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                  {
                                                                                                      // Scale down by 2 times using Bilinear resampling.
                                                                                                      image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);

                                                                                                      // Save to PNG with default options.
                                                                                                      image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                  }

Resize(int, int, imageResizeSettings)

Ristrutturare l’immagine.

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

Parameters

newWidth int

La nuova larghezza.

newHeight int

La nuova altezza.

settings ImageResizeSettings

Il ripristino delle impostazioni.

Examples

Cet exemple charge une image cachée et la réaffiche en utilisant divers paramètres de récitation.

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.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                   {
                                                                                                       // Scale down by 2 times using adaptive resampling.
                                                                                                       image.Resize(image.Width / 2, image.Height / 2, resizeSettings);
                                                                                                       image.Save(dir + "downsample.adaptive.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                   }

Rotate(fleat, bool, couleur)

Immagini girate intorno al centro.

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

Parameters

angle float

L’angolo di rotazione in gradi. valori positivi gireranno in orologio.

resizeProportionally bool

se impostato a ’true’ avrai la dimensione dell’immagine modificata in base alle proiezioni rettangoli rotate (punti angolare) in caso diverso che lascia le dimensioni non toccate e solo i contenuti dell’immagine interna sono rotati.

backgroundColor Color

Il colore del background.

RotateFlip(RotateFlipType)

Rotate, flips, o rotate e flips l’immagine.

public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

Il tipo di flip rotato.

Examples

Cet exemple charge une image cachée de raster, la tourne à 90 degrés d’horloge et flique optionnellement l’image horizontalement et/ou verticalement.

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

                                                                                                                                                       Aspose.Imaging.RotateFlipType[] rotateFlipTypes = new Aspose.Imaging.RotateFlipType[]
                                                                                                                                                       {
                                                                                                                                                           Aspose.Imaging.RotateFlipType.Rotate90FlipNone,
                                                                                                                                                           Aspose.Imaging.RotateFlipType.Rotate90FlipX,
                                                                                                                                                           Aspose.Imaging.RotateFlipType.Rotate90FlipXY,
                                                                                                                                                           Aspose.Imaging.RotateFlipType.Rotate90FlipY,
                                                                                                                                                       };

                                                                                                                                                       foreach (Aspose.Imaging.RotateFlipType rotateFlipType in rotateFlipTypes)
                                                                                                                                                       {
                                                                                                                                                           // Rotate, flip and save to the output file.
                                                                                                                                                           using (Aspose.Imaging.RasterCachedImage image = (Aspose.Imaging.RasterCachedImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                                                           {
                                                                                                                                                               image.RotateFlip(rotateFlipType);
                                                                                                                                                               image.Save(dir + "sample." + rotateFlipType + ".bmp");
                                                                                                                                                           }
                                                                                                                                                       }
 Français