Class PngImage

Class PngImage

이름 공간 : Aspose.Imaging.FileFormats.Png 모임: Aspose.Imaging.dll (25.4.0)

우리의 다양한 API를 사용하여 휴대용 네트워크 그래픽 (PNG) 라스터 이미지를 조작하십시오.압축 수준 및 다양한 색상 깊이에 대한 지원을 제공합니다.Grayscale, Indexed Color, TrueColor, 그리고 알파 채널.포괄적 인 이미지 메타 데이터 관리, 동시에 쉽게 PNG 이미지를 충전 할 수 있도록,다양한 조작을 수행하고, 필터를 적용하고, 이미지를 다른 파일로 변환합니다.최적의 다양성과 사용자 정의를 위한 형식.

[JsonObject(MemberSerialization.OptIn)]
public class PngImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage PngImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata

상속 회원들

RasterCachedImage.CacheData() , RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) , RasterCachedImage.Resize(int, int, ResizeType) , RasterCachedImage.Resize(int, int, ImageResizeSettings) , RasterCachedImage.RotateFlip(RotateFlipType) , RasterCachedImage.Rotate(float, bool, Color) , RasterCachedImage.Crop(Rectangle) , RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) , RasterCachedImage.Grayscale() , RasterCachedImage.NormalizeHistogram() , RasterCachedImage.BinarizeFixed(byte) , RasterCachedImage.BinarizeOtsu() , RasterCachedImage.BinarizeBradley(double, int) , RasterCachedImage.BinarizeBradley(double) , RasterCachedImage.AdjustBrightness(int) , RasterCachedImage.AdjustContrast(float) , RasterCachedImage.AdjustGamma(float, float, float) , RasterCachedImage.AdjustGamma(float) , RasterCachedImage.OnCached() , RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette) , RasterCachedImage.IsCached , 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

이 예제는 파일에서 PNG 이미지를 업로드하는 방법을 보여줍니다.

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

                                                                  // Load a PNG image from a file.
                                                                  using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png"))
                                                                  {
                                                                      // Transform the image to grayscale representation
                                                                      pngImage.Grayscale();

                                                                      // Save to a file.
                                                                      pngImage.Save(dir + "sample.grayscale.png");
                                                                  }

Constructors

PngImage(이트, 이트)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 개체를 시작하여폭 및 높이 매개 변수.이 건축기는 PNG의 생성을 단순화합니다.이미지를 개발자가 직접 차원을 지정할 수 있도록 허용함으로써그들의 응용 프로그램 내에서 PNG 이미지 데이터의 효율적인 관리.

public PngImage(int width, int height)

Parameters

width int

넓은 넓은

height int

높이에 대하여

Examples

이 예제는 지정된 크기의 PNG 이미지를 만드는 방법, 단단한 색상으로 채우고 파일에 저장하는 방법을 보여줍니다.

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

                                                                                                                                // Create a PNG image of 100x100 px.
                                                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100))
                                                                                                                                {
                                                                                                                                    // Do some image processing, e.g. fill the entire image in red.
                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
                                                                                                                                    Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                                                    graphics.FillRectangle(brush, pngImage.Bounds);

                                                                                                                                    // Save to a file.
                                                                                                                                    pngImage.Save(dir + "output.png");
                                                                                                                                }

PngImage(스트리트)

Aspose.Imaging.FileFormats.Png.PngImage 클래스를 사용하여 새로운 예를 만듭니다.파라미터는 이미지 파일의 위치를 지정합니다.이 건축기개발자가 편리하게 파일에서 PNG 이미지를 업로드함으로써 PNG 이미지를 만들 수 있습니다.그들의 응용 프로그램에서 PNG 이미지를 사용하는 과정을 단순화.

public PngImage(string path)

Parameters

path string

그림을 충전하는 길입니다.

Examples

이 예제는 파일에서 PNG 이미지를 업로드하는 방법을 보여줍니다.

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

                                                                  // Load a PNG image from a file.
                                                                  using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png"))
                                                                  {
                                                                      // Transform the image to grayscale representation
                                                                      pngImage.Grayscale();

                                                                      // Save to a file.
                                                                      pngImage.Save(dir + "sample.grayscale.png");
                                                                  }

PngImage(RasterImage)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 사례를 생성하여 라스터를 제공합니다.이 컨테이너는 개발자가 직접 이니셔티브를 시작할 수 있습니다.PNG 이미지 개체는 기존의 라스터 이미지를 사용하여 프로세스를 단순화합니다.그들의 응용 프로그램에서 PNG 이미지를 사용합니다.

public PngImage(RasterImage rasterImage)

Parameters

rasterImage RasterImage

라스터 이미지 입니다.

Examples

이 예제는 BMP 이미지에서 PNG 이미지를 충전하는 방법을 보여줍니다.

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

                                                                     // Load a TrueColor PNG image from a BMP image.
                                                                     // First, create a temporal BMP image that will be a foundation for building a PNG image.
                                                                     // You can also load BMP image from a file or use an image of any other raster format.
                                                                     using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                     {
                                                                         // Fill the entire BMP image in red.
                                                                         Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                         Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                         gr.FillRectangle(brush, bmpImage.Bounds);

                                                                         using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(bmpImage))
                                                                         {
                                                                             System.Console.WriteLine("The PNG color type: {0}", pngImage.GetOriginalOptions());
                                                                             pngImage.Save(dir + "output.png");
                                                                         }
                                                                     }

PngImage(링크, PngColorType)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 예를 시작하여이미지 파일 및 색상 유형으로 경로.이 건축기는 편리한다른 색상 유형의 파일에서 PNG 이미지를 생성, 제공다양한 이미지 형식을 처리하는 유연성.

public PngImage(string path, PngColorType colorType)

Parameters

path string

그림을 충전하는 길입니다.

colorType PngColorType

색상 유형 입니다.

Examples

이 예제는 지정된 색상 유형을 가진 파일에서 PNG 이미지를 업로드하는 방법을 보여줍니다.

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

                                                                                                // Load a PNG image from a file.
                                                                                                // Note that the colorful image will be converted to grayscale automatically.
                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(dir + "sample.png", Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                {
                                                                                                    // Save to a file.
                                                                                                    pngImage.Save(dir + "sample.grayscale.png");
                                                                                                }

Exceptions

ArgumentNullException

PngImage(라스테르 이미지, PngColorType)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 예를 만들기라스터 이미지 및 색상 유형.이 건축기는 개발자가 직접라스터 이미지를 PNG 형식으로 변환하고 원하는 색상 유형을 지정합니다.색상 표현에 대한 유연성을 제공합니다.

public PngImage(RasterImage rasterImage, PngColorType colorType)

Parameters

rasterImage RasterImage

라스터 이미지 입니다.

colorType PngColorType

색상 유형 입니다.

Examples

이 예제는 지정된 색상 유형으로 BMP 이미지에서 PNG 이미지를 충전하는 방법을 보여줍니다.

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

                                                                                                   // Load a grayscale PNG image from a colored BMP image.
                                                                                                   // First, create a temporal BMP image that will be a foundation for building a PNG image.
                                                                                                   // You can also load BMP image from a file or use an image of any other raster format.
                                                                                                   using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100))
                                                                                                   {
                                                                                                       // Fill the entire BMP image in red.
                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(bmpImage);
                                                                                                       Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                       gr.FillRectangle(brush, bmpImage.Bounds);

                                                                                                       // The colors of the image pixels will be converted to their grayscale counterparts.
                                                                                                       using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(bmpImage, Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                       {
                                                                                                           pngImage.Save(dir + "output.grayscale.png");
                                                                                                       }
                                                                                                   }

PngImage(Stream)

그것을 시작하여 Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 예를 만듭니다.이 건축기는 개발자가 PNG 이미지를 직접 로드 할 수 있습니다.흐름에서, 다양한 출처에서 이미지 수신에 대한 유연성을 제공합니다.

public PngImage(Stream stream)

Parameters

stream Stream

흐름은 이미지를 충전하는 것입니다.

Examples

이 예제는 파일 또는 파일 스트림에서 PNG 이미지를 업로드하는 방법을 보여줍니다.

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

                                                                                   // Load a PNG image from a file stream.
                                                                                   using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.png"))
                                                                                   {
                                                                                       using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(stream))
                                                                                       {
                                                                                           // Transform the image to grayscale representation
                                                                                           pngImage.Grayscale();

                                                                                           // Save to a file.
                                                                                           pngImage.Save(dir + "sample.grayscale.png");
                                                                                       }
                                                                                   }

PngImage(인트, 인트, PngColorType)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 신선한 예를 즉시 지정합니다.원하는 폭, 높이 및 색상 유형의 매개 변수.이 건축기는조정된 크기와 색상 구성으로 PNG 이미지의 빠른 생성,다양한 응용 프로그램 및 작업 흐름을위한 가속화 된 이미지 생성을 촉진합니다.

public PngImage(int width, int height, PngColorType colorType)

Parameters

width int

넓은 넓은

height int

높이에 대하여

colorType PngColorType

색상 유형 입니다.

Examples

이 예제는 지정된 색상 유형으로 지정된 크기의 PNG 이미지를 만드는 방법을 보여주고, 단단한 색상으로 채우고 파일에 저장합니다.

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

                                                                                                                                                              // Create a grayscale PNG image of 100x100 px.
                                                                                                                                                              // All colors will be automatically converted to the grayscale format.
                                                                                                                                                              using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(100, 100, Aspose.Imaging.FileFormats.Png.PngColorType.Grayscale))
                                                                                                                                                              {
                                                                                                                                                                  // Do some image processing, e.g. fill the entire image in red.
                                                                                                                                                                  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);
                                                                                                                                                                  Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                                                                                                  graphics.FillRectangle(brush, pngImage.Bounds);

                                                                                                                                                                  // Save to a file.
                                                                                                                                                                  pngImage.Save(dir + "output.grayscale.png");
                                                                                                                                                              }

PngImage(옵션, int, int)

Aspose.Imaging.FileFormats.Png.PngImage 클래스의 새로운 예를 시작하십시오.PNG 옵션은 폭 및 높이 매개 변수 옆에 있습니다.이 건축기는개발자는 사용자 지정 설정을 가진 PNG 이미지를 만들고,다양한 사용 사례에 대한 이미지 생성의 유연성을 제공합니다.

public PngImage(PngOptions pngOptions, int width, int height)

Parameters

pngOptions PngOptions

png 옵션

width int

넓은 넓은

height int

높이에 대하여

Examples

이 예제는 지정된 옵션으로 PNG 이미지를 만드는 방법을 보여주고, 선형 그라디언트 색상으로 채우고 파일에 저장합니다.

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

                                                                                                                                                Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();

                                                                                                                                                // The number of bits per color channel
                                                                                                                                                createOptions.BitDepth = 8;

                                                                                                                                                // Each pixel is a (red, green, blue) triple followed by the alpha component.
                                                                                                                                                createOptions.ColorType = Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;

                                                                                                                                                // The maximum level of compression.
                                                                                                                                                createOptions.CompressionLevel = 9;

                                                                                                                                                // Usage of filters allows to compress continuous tonal images more effectively.
                                                                                                                                                createOptions.FilterType = Aspose.Imaging.FileFormats.Png.PngFilterType.Sub;

                                                                                                                                                // Use progressive loading
                                                                                                                                                createOptions.Progressive = true;

                                                                                                                                                // Create a PNG image with custom parameters.
                                                                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage pngImage = new Aspose.Imaging.FileFormats.Png.PngImage(createOptions, 100, 100))
                                                                                                                                                {
                                                                                                                                                    Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
                                                                                                                                                            new Aspose.Imaging.Point(0, 0),
                                                                                                                                                            new Aspose.Imaging.Point(pngImage.Width, pngImage.Height),
                                                                                                                                                            Aspose.Imaging.Color.Blue,
                                                                                                                                                            Aspose.Imaging.Color.Transparent);

                                                                                                                                                    Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                    // Fill the image with a semi-transparent gradient.
                                                                                                                                                    graphics.FillRectangle(gradientBrush, pngImage.Bounds);

                                                                                                                                                    // Save to a file.
                                                                                                                                                    pngImage.Save(dir + "output.explicitoptions.png");
                                                                                                                                                }

Properties

BackgroundColor

그림의 배경 색상을 반환, 하나가 지정된 경우.이 속성식별 및 잠재적으로 조작해야하는 응용 프로그램에 도움이됩니다.이미지의 배경 색상.

public override Color BackgroundColor { get; set; }

부동산 가치

Color

Examples

다음 예제는 알파 채널을 지원하지 않는 TrueColor PNG 이미지의 일부에 대해 완전히 투명한 색상을 설정하는 방법을 보여줍니다.

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

BitsPerPixel

이미지를위한 픽셀 당 비트를 복구합니다.이 속성은 중요합니다.이미지의 색상 깊이에 대한 정보, 개발자가 할 수 있도록이미지 데이터에 존재하는 세부 사항 및 색상 정확도를 이해합니다.

public override int BitsPerPixel { get; }

부동산 가치

int

FileFormat

이미지 예제와 관련된 파일 형식을 리트리드합니다.이재산은 파일 유형에 관한 필수 정보를 제공하며,특정 형식 요구 사항에 따라 효율적인 처리 및 처리.

public override FileFormat FileFormat { get; }

부동산 가치

FileFormat

HasAlpha

이미지가 알파 채널이 있는지 여부를 나타내는 볼레안 값을 반환합니다.그것의 투명성을 결정합니다.이 재산은 응용 프로그램에 유용합니다.그것은 투명성을 다루고 개발자가 결정할 수 있도록해야합니다.이미지의 투명한 영역을 처리하기 위해 추가 처리가 필요합니다.

public override bool HasAlpha { get; }

부동산 가치

bool

Examples

다음 예제는 PNG 이미지가 알파 채널을 지원하는지 확인하는 방법을 보여줍니다.

// Get all supported PNG color types.
                                                                                          System.Array colorTypes = System.Enum.GetValues(typeof(Aspose.Imaging.FileFormats.Png.PngColorType));

                                                                                          foreach (Aspose.Imaging.FileFormats.Png.PngColorType colorType in colorTypes)
                                                                                          {
                                                                                              Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                              createOptions.Source = new Sources.StreamSource(new System.IO.MemoryStream());
                                                                                              createOptions.ColorType = colorType;

                                                                                              using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                              {
                                                                                                  Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

                                                                                                  if (pngImage.HasAlpha)
                                                                                                  {
                                                                                                      System.Console.WriteLine("A {0} PNG image supports alpha channel", createOptions.ColorType);
                                                                                                  }
                                                                                                  else
                                                                                                  {
                                                                                                      System.Console.WriteLine("A {0} PNG image doesn't support alpha channel", createOptions.ColorType);
                                                                                                  }
                                                                                              }
                                                                                          }

                                                                                          // The output looks like this:
                                                                                          // A Grayscale PNG image doesn't support alpha channel
                                                                                          // A Truecolor PNG image doesn't support alpha channel
                                                                                          // A IndexedColor PNG image doesn't support alpha channel
                                                                                          // A GrayscaleWithAlpha PNG image supports alpha channel
                                                                                          // A TruecolorWithAlpha PNG image supports alpha channel

HasBackgroundColor

그림이 배경 색깔이 있는지 여부를 나타내는 볼렌 값을 반환합니다.이 속성은 이미지가 있는지 확인해야 하는 응용 프로그램에 유용합니다.배경 색상이 포함되어 있으며, 이는 다양한 처리에 중요 할 수 있습니다.컴포지션, 렌더링 또는 수출과 같은 작업.

public override bool HasBackgroundColor { get; set; }

부동산 가치

bool

Examples

다음 예제는 알파 채널을 지원하지 않는 TrueColor PNG 이미지의 일부에 대해 완전히 투명한 색상을 설정하는 방법을 보여줍니다.

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

HasTransparentColor

Boolean 값을 제공하여 이미지에 투명한 값이 있는지 여부를 나타냅니다.색상.이 재산은 처리해야하는 응용 프로그램에 필수적입니다투명성, 개발자가 추가 처리가 있는지 확인할 수 있도록이미지에서 투명한 지역을 처리해야합니다.

public override bool HasTransparentColor { get; set; }

부동산 가치

bool

Examples

다음 예제는 알파 채널을 지원하지 않는 TrueColor PNG 이미지의 일부에 대해 완전히 투명한 색상을 설정하는 방법을 보여줍니다.

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

Height

이미지의 높이를 얻으십시오.이 속성은 수직 차원을 반환합니다.이미지, 개발자가 그것의 크기를 픽셀에 따라 결정할 수 있도록좌석 좌석

public override int Height { get; }

부동산 가치

int

HorizontalResolution

이미지의 수평 해상도를 복구하거나 변경합니다.이 속성그것은 인치당 픽셀의 수를 나타내며, 그것의 수평 좌석을 따라이 해상도를 조정하면 이미지의 물리적 크기에 영향을 미칠 수 있습니다.인쇄 또는 표시

public override double HorizontalResolution { get; set; }

부동산 가치

double

Examples

다음 예제는 PNG 이미지의 수평 / 수직 해상도를 설정하는 방법을 보여줍니다.

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

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

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

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

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

Interlaced

Aspose.Imaging.FileFormats.Png.PngImage가 있는지 여부를 나타내는 볼륨 값을 반환합니다.interlaced, 이미지 데이터가 점진적으로 저장되는지 여부를 결정하는더 빠른 충전 또는 전송을 위한 방법

public bool Interlaced { get; }

부동산 가치

bool

IsInterlaced

Boolean 값을 반환하여 이미지 예제가 연결되어 있는지 여부를 나타냅니다.재산은 충전 전략을 최적화하고 효율성을 보장하는 데 필수적입니다.이미지 처리 또는 표시 작업 중 성능.

public bool IsInterlaced { get; }

부동산 가치

bool

RawDataFormat

이미지의 원료 데이터 형식에 액세스합니다.이 속성은이미지 데이터가 어떻게 내부적으로 구조화되었는지, 이는 고급 데이터에 도움이 될 수 있습니다.이미지 처리 작업 또는 형식 변환.

public override PixelDataFormat RawDataFormat { get; }

부동산 가치

PixelDataFormat

Examples

다음 예제는 PNG 이미지를 업로드하고 원료 데이터 형식 및 알파 채널에 대한 정보를 인쇄합니다.

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

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

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

TransparentColor

그것은 이미지의 투명한 색상을 반환합니다, 그것이 존재한다면.이 속성은투명한 영역의 정확한 관리가 필요한 응용 프로그램에 가치가 있습니다.이미지 내에서, 개발자가 액세스하고 구체적인 조작을 할 수 있도록사용되는 투명한 색상

public override Color TransparentColor { get; set; }

부동산 가치

Color

Examples

다음 예제는 알파 채널을 지원하지 않는 TrueColor PNG 이미지의 일부에 대해 완전히 투명한 색상을 설정하는 방법을 보여줍니다.

Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                   createOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\transparent.png", false);
                                                                                                                                                   createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.Truecolor;

                                                                                                                                                   // Create a TrueColor PNG image of 100x100 px.
                                                                                                                                                   using (Aspose.Imaging.Image image = Image.Create(createOptions, 100, 100))
                                                                                                                                                   {
                                                                                                                                                       Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;
                                                                                                                                                       Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);

                                                                                                                                                       // All red pixels will be considered as fully transparent.
                                                                                                                                                       pngImage.TransparentColor = Aspose.Imaging.Color.Red;
                                                                                                                                                       pngImage.HasTransparentColor = true;

                                                                                                                                                       // All transparent pixels will have a background color.
                                                                                                                                                       pngImage.BackgroundColor = Aspose.Imaging.Color.Green;
                                                                                                                                                       pngImage.HasBackgroundColor = true;

                                                                                                                                                       // Fill the entire image with white color.
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White), pngImage.Bounds);

                                                                                                                                                       // Fill the top-left quarter of the image with the transparent color.
                                                                                                                                                       // This makes the top-left quarter colored in the background color.
                                                                                                                                                       Rectangle rect = new Rectangle(0, 0, pngImage.Width / 2, pngImage.Height / 2);
                                                                                                                                                       gr.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red), rect);

                                                                                                                                                       pngImage.Save();
                                                                                                                                                   }

VerticalResolution

이미지의 수직 해상도에 대한 액세스를 제공합니다. 개발자는 사용할 수 있습니다.이 재산은 해상도 설정을 취득하거나 변경할 수 있으며, 이는이미지의 수직 좌석을 따라 인치당 픽셀 수 (PPI)

public override double VerticalResolution { get; set; }

부동산 가치

double

Examples

다음 예제는 PNG 이미지의 수평 / 수직 해상도를 설정하는 방법을 보여줍니다.

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

                                                                                                using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
                                                                                                {
                                                                                                    Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)image;

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

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

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

Width

이미지의 폭을 복구 할 수 있도록, 필수 정보를 제공이 재산은 개발자들에 의해 자주 사용됩니다.이미지의 폭을 결정하여 다양한 작업을 수행 할 수 있습니다.그것의 크기에 따라

public override int Width { get; }

부동산 가치

int

XmpData

확장 가능한 메타데이터 플랫폼 (XMP)과 관련된 메타데이터에 액세스하거나 변경이 재산은 추출, 수정, 또는메타데이터를 추가하여 이미지 관련 정보의 포괄적 인 관리가 가능합니다.

public override XmpPacketWrapper XmpData { get; set; }

부동산 가치

XmpPacketWrapper

Methods

GetDefaultOptions(객체[])

기본 옵션을 제공합니다.

public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object [ ] [ [ ]

그들의 논쟁들

Returns

ImageOptionsBase

기본 옵션

GetModifyDate(바울)

자원의 최신 변경 사항을 나타내는 시간표를 반환합니다.이 방법은 필수 메타데이터에 대한 액세스를 제공하며, 응용 프로그램을 사용할 수 있습니다.이미지가 마지막으로 변경되었을 때를 확인하여 버전 추적을 촉진하고컨텐츠 관리

public override DateTime GetModifyDate(bool useDefault)

Parameters

useDefault bool

‘진실’으로 설정하면 FileInfo의 정보를 기본 값으로 사용합니다.

Returns

DateTime

리소스 이미지의 날짜와 시간이 마지막으로 수정되었습니다.

GetOriginalOptions()

원본 파일 설정을 기반으로 옵션을 얻습니다.이것은 비트 깊이와 원본 이미지의 다른 매개 변수를 변함없이 유지하는 데 도움이 될 수 있습니다.예를 들어, 블랙 흰색 PNG 이미지를 픽셀 당 1비트로 충전하고 그것을 저장하면Aspose.Imaging.DataStreamSupporter.Save(System.String) 방법, 출력 PNG 이미지 8 비트 / 픽셀이 생성됩니다.그것을 피하고 픽셀 당 1 비트로 PNG 이미지를 저장하려면이 방법을 사용하여 해당 저장 옵션을 얻고 통과하십시오.Aspose.Imaging.Image.Save(System.String,Aspose.Imaging.ImageOptionsBase) 방법은 두 번째 매개 변수입니다.

public override ImageOptionsBase GetOriginalOptions()

Returns

ImageOptionsBase

원본 파일 설정에 기초한 옵션.

OnPaletteChanged(아이콜라스, 아이콜라스)

팔레트가 변경되면 전화를 받습니다.

protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)

Parameters

oldPalette IColorPalette

오래된 팔레트

newPalette IColorPalette

새로운 팔레트

SaveData(Stream)

데이터를 저장합니다.

protected override void SaveData(Stream stream)

Parameters

stream Stream

그 흐름을

UpdateDimensions(이트, 이트)

업데이트의 차원

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

새로운 광도 입니다.

newHeight int

새로운 높이 입니다.

UpdateMetadata()

이미지의 마지막 수정 날짜와 시간을 업데이트합니다.

protected override void UpdateMetadata()
 한국어