Class RasterCachedImage

Class RasterCachedImage

Nome do espaço: Aspose.Imaging Assembleia: Aspose.Imaging.dll (25.4.0)

Representa uma imagem de raster que suporta operações de gráficos de raster. Esta imagem cache dados de pixel quando necessário.

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

Membros herdados

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

O exemplo a seguir transforma uma imagem encaixada em raster colorida em sua representação de grayscale. imagens de grayscale são compostas exclusivamente de sombras de cinza e carregam apenas informações de intensidade.

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

Inicia uma nova instância da classe Aspose.Imaging.RasterCachedImage.

protected RasterCachedImage()

RasterCachedImage(Iluminação)

Inicia uma nova instância da classe Aspose.Imaging.RasterCachedImage.

protected RasterCachedImage(IColorPalette colorPalette)

Parameters

colorPalette IColorPalette

A paleta de cores.

Properties

IsCached

Recebe um valor indicando se os dados da imagem estão cache atualmente.

public override bool IsCached { get; }

Valor da propriedade

bool

Methods

AdjustBrightness(Int)

Ajuste de brilho para a imagem.

public override void AdjustBrightness(int brightness)

Parameters

brightness int

Valor de brilho.

Examples

O exemplo a seguir realiza a correção de brilho de uma imagem encaixada por 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(Flotação)

Imagem Contraste

public override void AdjustContrast(float contrast)

Parameters

contrast float

Valor de contraste (em faixa [-100; 100])

Examples

O exemplo a seguir realiza a correção de contraste de uma imagem encaixada por 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(Flotas, Flotas e Flotas)

Correção de Gamma de uma imagem.

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

Parameters

gammaRed float

Gamma para o Coeficiente de Canais Vermelhos

gammaGreen float

Gamma para o coeficiente de canais verdes

gammaBlue float

Gamma para o coeficiente de canais azuis

Examples

O exemplo a seguir realiza a correção gamma de uma imagem encaixada por raster aplicando coeficientes diferentes para os componentes de cores.

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(Flotação)

Correção de Gamma de uma imagem.

public override void AdjustGamma(float gamma)

Parameters

gamma float

Gamma para os canais vermelho, verde e azul coeficiente

Examples

O exemplo a seguir realiza a correção gamma de uma imagem encaixada por 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(duplo, int)

Binarização de uma imagem usando o algoritmo de limite de adaptação de Bradley usando o limite de imagem integral

public override void BinarizeBradley(double brightnessDifference, int windowSize)

Parameters

brightnessDifference double

A diferença de brilho entre o pixel e a média de uma janela s x s de pixels centrada em torno deste pixel.

windowSize int

O tamanho da janela s x s de pixels centrada em torno deste pixel

Examples

O exemplo a seguir binariza uma imagem encaixada com o algoritmo de limite adaptativo de Bradley com o tamanho da janela especificado. imagens binárias contêm apenas 2 cores - preto e branco.

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

Binarização de uma imagem usando o algoritmo de limite de adaptação de Bradley usando o limite de imagem integral

public override void BinarizeBradley(double brightnessDifference)

Parameters

brightnessDifference double

A diferença de brilho entre o pixel e a média de uma janela s x s de pixels centrada em torno deste pixel.

Examples

O exemplo a seguir binariza uma imagem encaixada com o algoritmo de limite adaptativo de Bradley. imagens binárias contêm apenas 2 cores - preto e branco.

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

Binarização de uma imagem com um limiar predefinido

public override void BinarizeFixed(byte threshold)

Parameters

threshold byte

Se o valor cinzento correspondente de um pixel for maior do que o limite, um valor de 255 será atribuído a ele, 0 de outra forma.

Examples

O exemplo a seguir binariza uma imagem encaixada com o limiar predefinido. imagens binárias contêm apenas 2 cores - preto e branco.

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

Binarização de uma imagem com o limite Otsu

public override void BinarizeOtsu()

Examples

O exemplo a seguir binariza uma imagem encaixada com o limite Otsu. imagens binárias contêm apenas 2 cores - preto e branco.

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

Misture esta imagem com a imagem overlay".

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

Parameters

origin Point

A imagem de fundo misturando a origem.

overlay RasterImage

A imagem sobrecarregada.

overlayArea Rectangle

Área de Overlay.

overlayAlpha byte

A superfície da alfa.

CacheData()

Esconde os dados e garante que não haverá carregamento adicional de dados do Aspose.Imaging.DataStreamSupporter.DataStreamContainer.

public override void CacheData()

Examples

O exemplo a seguir mostra como o caching de imagem raster afeta o desempenho.Em geral, a leitura de dados cache é realizada mais rápido do que a leitura de dados não cache.

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)

Criação da imagem.

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

do rectangulo.

Examples

O exemplo a seguir colhe uma imagem cache de raster. A área de colheita é especificada através de 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étodo, int, IColorPalette)

Exercícios que se dividem na imagem atual.

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

Parameters

ditheringMethod DitheringMethod

Metodologia do Dilúvio.

bitsCount int

Os bits finais contam para dithering.

customPalette IColorPalette

A paleta custom para dithering.

Grayscale()

Transformação de uma imagem em sua representação grauscale

public override void Grayscale()

Examples

O exemplo a seguir transforma uma imagem encaixada em raster colorida em sua representação de grayscale. imagens de grayscale são compostas exclusivamente de sombras de cinza e carregam apenas informações de intensidade.

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

Normalize o histograma da imagem — ajuste os valores de pixel para usar todas as faixas disponíveis.

public override void NormalizeHistogram()

OnCached()

Chamado quando os dados são cache e todos os recursos relacionados podem ser desallocados.

protected virtual void OnCached()

OnPaletteChanged(Coloração, Coloração, Coloração)

Chamado quando a paleta é mudada.

protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette

A velha paleta.

newPalette IColorPalette

A nova paleta.

Resize(Int, Int, ResizeType)

Recuperar a imagem.

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

Parameters

newWidth int

A nova amplitude.

newHeight int

A nova altura.

resizeType ResizeType

O tipo de resgate.

Examples

Este exemplo carrega uma imagem raster cache e o resisa usando vários métodos de resisão.

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, ImagemResizeSettings)

Recuperar a imagem.

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

Parameters

newWidth int

A nova amplitude.

newHeight int

A nova altura.

settings ImageResizeSettings

As definições de recessão.

Examples

Este exemplo carrega uma imagem encaixada por raster e a resisa usando várias configurações de resisão.

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(Float, Bool, Coloração)

Rotando a imagem ao redor do centro.

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

Parameters

angle float

O ângulo de rotação em graus. valores positivos girarão de maneira horária.

resizeProportionally bool

Se configurado para “verdadeiro”, você terá o seu tamanho da imagem alterado de acordo com as projeções de rectangular rotado (punto de corno) noutro caso que deixa as dimensões não tocadas e apenas os conteúdos da imagem interna são rotados.

backgroundColor Color

A cor do fundo.

RotateFlip(RotateFlipType)

Rota, flips, ou rota e flips a imagem.

public override void RotateFlip(RotateFlipType rotateFlipType)

Parameters

rotateFlipType RotateFlipType

Tipo de flip rotativo.

Examples

Este exemplo carrega uma imagem encaixada por raster, a rota por 90 graus de olho e, opcionalmente, flipa a imagem horizontalmente e/ou verticalmente.

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