Class RasterImage
이름 공간 : Aspose.Imaging 모임: Aspose.Imaging.dll (25.4.0)
라스터 그래픽 작업을 지원하는 라스터 이미지를 나타냅니다.
public abstract class RasterImage : Image, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage
Derived
Implements
IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasMetadata
상속 회원들
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
이 예제는 유형 색상 범위에서 픽셀 정보를 업로드하는 방법을 보여주고, 범위를 조작하고 이미지로 다시 설정합니다.이 작업을 수행하려면 이 예제는 새로운 이미지 파일 (GIF 형식) uisng MemoryStream 개체를 생성합니다.
//Create an instance of MemoryStream
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
//Create an instance of GifOptions and set its various properties including the Source property
Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
{
//Get the pixels of image by specifying the area as image boundary
Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);
//Loop over the Array and sets color of alrenative indexed pixel
for (int index = 0; index < pixels.Length; index++)
{
if (index % 2 == 0)
{
//Set the indexed pixel color to yellow
pixels[index] = Aspose.Imaging.Color.Yellow;
}
else
{
//Set the indexed pixel color to blue
pixels[index] = Aspose.Imaging.Color.Blue;
}
}
//Apply the pixel changes to the image
image.SavePixels(image.Bounds, pixels);
// save all changes.
image.Save();
}
// Write MemoryStream to File
using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
{
stream.WriteTo(fileStream);
}
}
Constructors
RasterImage()
Aspose.Imaging.RasterImage 클래스의 새로운 예를 시작합니다.
[JsonConstructor]
protected RasterImage()
RasterImage(아이콜라 패널)
Aspose.Imaging.RasterImage 클래스의 새로운 예를 시작합니다.
protected RasterImage(IColorPalette colorPalette)
Parameters
colorPalette
IColorPalette
색상 팔레트
Fields
엑스포트
XMP 메타 데이터
[JsonProperty]
protected XmpPacketWrapper xmpData
필드 가치
Properties
DataLoader
데이터 충전기를 얻거나 설정합니다.
[JsonProperty]
protected IRasterImageArgb32PixelLoader DataLoader { get; set; }
부동산 가치
HasAlpha
이 경우 알파가 있는지 여부를 나타내는 값을 얻습니다.
public virtual bool HasAlpha { get; }
부동산 가치
Examples
다음 예제는 라스터 이미지를 업로드하고 원료 데이터 형식 및 알파 채널에 대한 정보를 인쇄합니다.
// The image files to load.
string[] fileNames = new string[]
{
@"c:\temp\sample.bmp",
@"c:\temp\alpha.png",
};
foreach (string fileName in fileNames)
{
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, rasterImage.RawDataFormat, rasterImage.HasAlpha);
}
}
// The output may look like this:
// ImageFile=c:\temp\sample.bmp, FileFormat=Rgb24Bpp, used channels: 8,8,8, HasAlpha=False
// ImageFile=c:\temp\alpha.png, FileFormat=RGBA32Bpp, used channels: 8,8,8,8, HasAlpha=True
다음 예제는 BMP 이미지에서 원료 데이터 형식 및 알파 채널에 대한 정보를 추출하는 방법을 보여줍니다.
// Create a 32-bpp BMP image of 100 x 100 px.
using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 32, null))
{
System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
};
// Create a 24-bpp BMP image of 100 x 100 px.
using (Aspose.Imaging.FileFormats.Bmp.BmpImage bmpImage = new Aspose.Imaging.FileFormats.Bmp.BmpImage(100, 100, 24, null))
{
System.Console.WriteLine("FileFormat={0}, RawDataFormat={1}, HasAlpha={2}", bmpImage.FileFormat, bmpImage.RawDataFormat, bmpImage.HasAlpha);
};
// Generally, BMP doesn't support alpha channel so the output will look like this:
// FileFormat = Bmp, RawDataFormat = Rgb32Bpp, used channels: 8,8,8,8, HasAlpha = False
// FileFormat = Bmp, RawDataFormat = Rgb24Bpp, used channels: 8,8,8, HasAlpha = False
HasTransparentColor
그림이 투명한 색깔이 있는지 여부를 나타내는 값을 얻습니다.
public virtual bool HasTransparentColor { get; set; }
부동산 가치
HorizontalResolution
이 Aspose.Imaging.RasterImage의 수평 해상도를 픽셀 당 인치로 얻거나 설정합니다.
public virtual double HorizontalResolution { get; set; }
부동산 가치
Examples
다음 예제는 라스터 이미지의 수평 / 수직 해상도를 설정하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get horizontal and vertical resolution of the image
double horizontalResolution = rasterImage.HorizontalResolution;
double verticalResolution = rasterImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
rasterImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
}
// The output may look like this:
// The horizontal resolution, in pixels per inch: 300
// The vertical resolution, in pixels per inch: 300
// Set resolution values to 96 dpi
// The horizontal resolution, in pixels per inch: 96
// The vertical resolution, in pixels per inch: 96
}
Remarks
기본적으로 이 값은 항상 96이기 때문에 다른 플랫폼이 스크린 해상도를 반환 할 수 없습니다.SetResolution 방법을 사용하여 하나의 전화에서 두 해상도 값을 업데이트 할 수 있습니다.
ImageOpacity
이 이미지의 비정상성을 얻습니다.
public virtual float ImageOpacity { get; }
부동산 가치
IsRawDataAvailable
원료 데이터 충전이 사용할 수 있는지 여부를 나타내는 값을 얻습니다.
public bool IsRawDataAvailable { get; }
부동산 가치
PremultiplyComponents
이미지 구성 요소가 과장되어야 하는지 여부를 나타내는 값을 얻거나 설정합니다.
public virtual bool PremultiplyComponents { get; set; }
부동산 가치
Examples
다음 예제는 새로운 라스터 이미지를 생성하고, 지정된 반 투명한 픽셀을 저장하고, 그 픽셀을 충전하고, 예상 형태로 최종 색상을 얻습니다.
int imageWidth = 3;
int imageHeight = 2;
Aspose.Imaging.Color[] colors = new Aspose.Imaging.Color[]
{
Aspose.Imaging.Color.FromArgb(127, 255, 0, 0),
Aspose.Imaging.Color.FromArgb(127, 0, 255, 0),
Aspose.Imaging.Color.FromArgb(127, 0, 0, 255),
Aspose.Imaging.Color.FromArgb(127, 255, 255, 0),
Aspose.Imaging.Color.FromArgb(127, 255, 0, 255),
Aspose.Imaging.Color.FromArgb(127, 0, 255, 255),
};
Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), true);
createOptions.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(createOptions, imageWidth, imageHeight))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Save pixels for the whole image.
rasterImage.SavePixels(rasterImage.Bounds, colors);
// The pixels are stored in the original image in the non-premultiplied form.
// Need to specify the corresponding option explicitly to obtain premultiplied color components.
// The premultiplied color components are calculated by the formulas:
// red = original_red * alpha / 255;
// green = original_green * alpha / 255;
// blue = original_blue * alpha / 255;
rasterImage.PremultiplyComponents = true;
Aspose.Imaging.Color[] premultipliedColors = rasterImage.LoadPixels(rasterImage.Bounds);
for (int i = 0; i < colors.Length; i++)
{
System.Console.WriteLine("Original color: {0}", colors[i].ToString());
System.Console.WriteLine("Premultiplied color: {0}", premultipliedColors[i].ToString());
}
}
RawCustomColorConverter
사용자 지정 색상 변환기를 얻거나 설정합니다.
public IColorConverter RawCustomColorConverter { get; set; }
부동산 가치
RawDataFormat
원료 데이터 형식을 얻습니다.
public virtual PixelDataFormat RawDataFormat { get; }
부동산 가치
Examples
다음 예제는 라스터 이미지를 업로드하고 원료 데이터 형식 및 알파 채널에 대한 정보를 인쇄합니다.
// The image files to load.
string[] fileNames = new string[]
{
@"c:\temp\sample.bmp",
@"c:\temp\alpha.png",
};
foreach (string fileName in fileNames)
{
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, rasterImage.RawDataFormat, rasterImage.HasAlpha);
}
}
// The output may look like this:
// ImageFile=c:\temp\sample.bmp, FileFormat=Rgb24Bpp, used channels: 8,8,8, HasAlpha=False
// ImageFile=c:\temp\alpha.png, FileFormat=RGBA32Bpp, used channels: 8,8,8,8, HasAlpha=True
이 예제는 파일 스트림에서 DJVU 이미지를 업로드하고 페이지에 대한 정보를 인쇄하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
// Load a DJVU image from a file stream.
using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.djvu"))
{
using (Aspose.Imaging.FileFormats.Djvu.DjvuImage djvuImage = new Aspose.Imaging.FileFormats.Djvu.DjvuImage(stream))
{
System.Console.WriteLine("The total number of pages: {0}", djvuImage.Pages.Length);
System.Console.WriteLine("The active page number: {0}", djvuImage.ActivePage.PageNumber);
System.Console.WriteLine("The first page number: {0}", djvuImage.FirstPage.PageNumber);
System.Console.WriteLine("The last page number: {0}", djvuImage.LastPage.PageNumber);
foreach (Aspose.Imaging.FileFormats.Djvu.DjvuPage djvuPage in djvuImage.Pages)
{
System.Console.WriteLine("--------------------------------------------------");
System.Console.WriteLine("Page number: {0}", djvuPage.PageNumber);
System.Console.WriteLine("Page size: {0}", djvuPage.Size);
System.Console.WriteLine("Page raw format: {0}", djvuPage.RawDataFormat);
}
}
}
//The output may look like this:
//The total number of pages: 2
//The active page number: 1
//The first page number: 1
//The last page number: 2
//--------------------------------------------------
//Page number: 1
//Page size: { Width = 2481, Height = 3508}
//Page raw format: RgbIndexed1Bpp, used channels: 1
//--------------------------------------------------
//Page number: 2
//Page size: { Width = 2481, Height = 3508}
//Page raw format: RgbIndexed1Bpp, used channels: 1
RawDataSettings
현재 원료 데이터 설정을 얻습니다.이 설정을 사용할 때 데이터는 변환없이 충전됩니다.
[JsonIgnore]
public RawDataSettings RawDataSettings { get; }
부동산 가치
RawFallbackIndex
팔레트 인덱스가 제한이 없을 때 사용하도록 Fallback 인덱스를 얻거나 설정합니다.
public int RawFallbackIndex { get; set; }
부동산 가치
RawIndexedColorConverter
인덱스된 색상 변환기를 얻거나 설정합니다.
public IIndexedColorConverter RawIndexedColorConverter { get; set; }
부동산 가치
RawLineSize
원료 라인 크기를 바이트로 얻습니다.
public virtual int RawLineSize { get; }
부동산 가치
TransparentColor
이미지를 투명한 색상으로 만듭니다.
public virtual Color TransparentColor { get; set; }
부동산 가치
UpdateXmpData
XMP 메타 데이터를 업데이트하는지 여부를 나타내는 값을 얻거나 설정합니다.
public virtual bool UpdateXmpData { get; set; }
부동산 가치
UsePalette
이미지 팔레트가 사용되는지 여부를 나타내는 값을 얻습니다.
public override bool UsePalette { get; }
부동산 가치
UseRawData
원료 데이터 충전이 사용할 수 있을 때 원료 데이터 충전을 사용하는지 여부를 나타내는 값을 얻거나 설정합니다.
public virtual bool UseRawData { get; set; }
부동산 가치
VerticalResolution
이 Aspose.Imaging.RasterImage의 수직 해상도를 픽셀 당 인치로 얻거나 설정합니다.
public virtual double VerticalResolution { get; set; }
부동산 가치
Examples
다음 예제는 라스터 이미지의 수평 / 수직 해상도를 설정하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get horizontal and vertical resolution of the image
double horizontalResolution = rasterImage.HorizontalResolution;
double verticalResolution = rasterImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
rasterImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
}
// The output may look like this:
// The horizontal resolution, in pixels per inch: 300
// The vertical resolution, in pixels per inch: 300
// Set resolution values to 96 dpi
// The horizontal resolution, in pixels per inch: 96
// The vertical resolution, in pixels per inch: 96
}
Remarks
기본적으로 이 값은 항상 96이기 때문에 다른 플랫폼이 스크린 해상도를 반환 할 수 없습니다.SetResolution 방법을 사용하여 하나의 전화에서 두 해상도 값을 업데이트 할 수 있습니다.
XmpData
XMP 메타 데이터를 얻거나 설정합니다.
public virtual XmpPacketWrapper XmpData { get; set; }
부동산 가치
Methods
AdjustBrightness(이트)
이미지에 대한 밝기를 조정합니다.
public virtual void AdjustBrightness(int brightness)
Parameters
brightness
int
빛의 가치
Examples
다음 예제는 이미지의 밝기 수정을 수행합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Set the brightness value. The accepted values of brightness are in the range [-255, 255].
rasterImage.AdjustBrightness(50);
rasterImage.Save(dir + "sample.AdjustBrightness.png");
}
AdjustContrast(플로트)
이미지 대조
public virtual void AdjustContrast(float contrast)
Parameters
contrast
float
대조 값 (내 범위 [-100; 100])
Examples
다음 예제는 이미지의 대조 수정을 수행합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Set the contrast value. The accepted values of contrast are in the range [-100f, 100f].
rasterImage.AdjustContrast(50);
rasterImage.Save(dir + "sample.AdjustContrast.png");
}
AdjustGamma(해군, 해군, 해군)
이미지의 Gamma 수정
public virtual void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
float
붉은 채널 요소를 위한 Gamma
gammaGreen
float
녹색 채널 요소를 위한 Gamma
gammaBlue
float
파란 채널 요소를 위한 Gamma
Examples
다음 예제는 색상 구성 요소에 다른 요소를 적용하는 이미지의 가마 수정을 수행합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Set individual gamma coefficients for red, green and blue channels.
rasterImage.AdjustGamma(1.5f, 2.5f, 3.5f);
rasterImage.Save(dir + "sample.AdjustGamma.png");
}
AdjustGamma(플로트)
이미지의 Gamma 수정
public virtual void AdjustGamma(float gamma)
Parameters
gamma
float
빨간색, 녹색 및 파란색 채널에 대한 Gamma
Examples
다음 예제는 이미지의 gamma-correction을 수행합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Set gamma coefficient for red, green and blue channels.
rasterImage.AdjustGamma(2.5f);
rasterImage.Save(dir + "sample.AdjustGamma.png");
}
BinarizeBradley(듀얼)
Bradley의 적응형 경계선 알고리즘을 사용하여 이미지의 이중화
public virtual void BinarizeBradley(double brightnessDifference)
Parameters
brightnessDifference
double
픽셀 사이의 밝기 차이와 이 픽셀 주위에 중심된 픽셀의 s x s 창의 평균 차이.
BinarizeBradley(이중, 이중)
Bradley의 적응형 경계선 알고리즘을 사용하여 이미지의 이중화
public virtual void BinarizeBradley(double brightnessDifference, int windowSize)
Parameters
brightnessDifference
double
픽셀 사이의 밝기 차이와 이 픽셀 주위에 중심된 픽셀의 s x s 창의 평균 차이.
windowSize
int
이 픽셀 주위에 중점을 둔 픽셀의 s x s 창의 크기
Examples
다음 예제는 Bradley의 적응 범위 알고리즘과 지정된 창 크기로 라스터 이미지를 이중화합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Binarize the image with a brightness difference of 5. The brightness is a difference between a pixel and the average of an 10 x 10 window of pixels centered around this pixel.
rasterImage.BinarizeBradley(5, 10);
rasterImage.Save(dir + "sample.BinarizeBradley5_10x10.png");
}
BinarizeFixed(바이트)
미리 정의된 한계를 가진 이미지의 바이너리화
public virtual void BinarizeFixed(byte threshold)
Parameters
threshold
byte
해당 픽셀의 회색 값이 한계를 초과하는 경우, 255의 값이 그것에 부여됩니다, 0 그렇지 않으면.
Examples
다음 예제는 사전 정의 한계를 가진 라스터 이미지를 바이너리화합니다. 바이너리화 된 이미지는 단지 2 가지 색상 - 검정색과 흰색을 포함합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Binarize the image with a threshold value of 127.
// If a corresponding gray value of a pixel is greater than 127, a value of 255 will be assigned to it, 0 otherwise.
rasterImage.BinarizeFixed(127);
rasterImage.Save(dir + "sample.BinarizeFixed.png");
}
BinarizeOtsu()
Otsu 프레젠테이션으로 이미지의 바이너리화
public virtual void BinarizeOtsu()
Examples
다음 예제는 Otsu 경계를 가진 라스터 이미지를 바이너리화합니다. 바이너리화 된 이미지는 단지 2 가지 색상 - 검정색과 흰색을 포함합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Binarize the image with Otsu thresholding.
rasterImage.BinarizeOtsu();
rasterImage.Save(dir + "sample.BinarizeOtsu.png");
}
Blend(포인트, RasterImage, Rectangle, 바이트)
이 이미지 예제를 overlay’ 이미지와 혼합합니다.
public virtual void Blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha = 255)
Parameters
origin
Point
배경 이미지 혼합 출처.
overlay
RasterImage
과도한 이미지입니다.
overlayArea
Rectangle
오버레이 영역 입니다.
overlayAlpha
byte
과도한 알파
Blend(포인트, RasterImage, 바이트)
이 이미지 예제를 overlay’ 이미지와 혼합합니다.
public void Blend(Point origin, RasterImage overlay, byte overlayAlpha = 255)
Parameters
origin
Point
배경 이미지 혼합 출처.
overlay
RasterImage
과도한 이미지입니다.
overlayAlpha
byte
과도한 알파
Dither(지정된 방법, int)
현재의 이미지를 흔들어 놓는다.
public void Dither(DitheringMethod ditheringMethod, int bitsCount)
Parameters
ditheringMethod
DitheringMethod
디트리밍 방법을 사용합니다.
bitsCount
int
마지막 비트는 디트링을 위해 계산됩니다.
Examples
다음 예제는 라스터 이미지를 충전하고 다른 팔레트 깊이를 사용하여 경계 및 흐름 디트링을 수행합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Perform threshold dithering using 4-bit color palette which contains 16 colors.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
rasterImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4);
rasterImage.Save(dir + "sample.ThresholdDithering4.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Perform floyd dithering using 1-bit color palette which contains only 2 colors - black and white.
// The more bits specified the higher quality and the bigger size of the output image.
// Note that only 1-bit, 4-bit and 8-bit palettes are supported at the moment.
rasterImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1);
rasterImage.Save(dir + "sample.FloydSteinbergDithering1.png");
}
Dither(Dithering 방법, int, IColorPalette)
현재의 이미지를 흔들어 놓는다.
public abstract void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethod
디트리밍 방법을 사용합니다.
bitsCount
int
마지막 비트는 디트링을 위해 계산됩니다.
customPalette
IColorPalette
Dithering을 위한 특정 팔레트.
Filter(오른쪽, FilterOptionsBase)
지정된 직경을 필터링합니다.
public virtual void Filter(Rectangle rectangle, FilterOptionsBase options)
Parameters
rectangle
Rectangle
오른쪽 쪽 쪽
options
FilterOptionsBase
그 옵션들
Examples
다음 예제는 다양한 유형의 필터를 라스터 이미지에 적용합니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a median filter with a rectangle size of 5 to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(5));
rasterImage.Save(dir + "sample.MedianFilter.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a bilateral smoothing filter with a kernel size of 5 to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.BilateralSmoothingFilterOptions(5));
rasterImage.Save(dir + "sample.BilateralSmoothingFilter.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a Gaussian blur filter with a radius of 5 and a sigma value of 4.0 to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussianBlurFilterOptions(5, 4.0));
rasterImage.Save(dir + "sample.GaussianBlurFilter.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a Gauss-Wiener filter with a radius of 5 and a smooth value of 4.0 to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(5, 4.0));
rasterImage.Save(dir + "sample.GaussWienerFilter.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a motion wiener filter with a length of 5, a smooth value of 4.0 and an angle of 90.0 degrees to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(10, 1.0, 90.0));
rasterImage.Save(dir + "sample.MotionWienerFilter.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Apply a sharpen filter with a kernel size of 5 and a sigma value of 4.0 to the entire image.
rasterImage.Filter(rasterImage.Bounds, new Aspose.Imaging.ImageFilters.FilterOptions.SharpenFilterOptions(5, 4.0));
rasterImage.Save(dir + "sample.SharpenFilter.png");
}
GetArgb32Pixel(이트, 이트)
이미지 32비트 ARGB 픽셀을 제공합니다.
public int GetArgb32Pixel(int x, int y)
Parameters
x
int
픽셀 x 위치
y
int
픽셀 및 위치
Returns
지정된 위치를 위한 32비트 ARGB 픽셀.
Examples
다음 예제는 라스터 이미지를 업로드하고 32 비트 전체 값으로 표현된 자발적인 픽셀의 색상을 얻습니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get an integer representation of the color of the top-left pixel of the image.
int color = rasterImage.GetArgb32Pixel(0, 0);
// To obtain the values of the individual color components, shift the color value by a corresponding number of bits
int alpha = (color >> 24) & 0xff;
int red = (color >> 16) & 0xff;
int green = (color >> 8) & 0xff;
int blue = (color >> 0) & 0xff;
System.Console.WriteLine("The color of the pixel(0,0) is A={0},R={1},G={2},B={3}", alpha, red, green, blue);
}
다음 예제는 이미지 캐싱이 성능에 어떤 영향을 미치는지 보여줍니다.일반적으로 캐시된 데이터를 읽는 것은 캐시되지 않은 데이터를 읽는 것보다 빠르게 수행됩니다.
string dir = "c:\\temp\\";
// Load an image from a PNG file.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
// Cache all pixel data so that no additional data loading will be performed from the underlying data stream
image.CacheData();
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
// Reading all pixels is pretty fast.
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
for (int y = 0; y < image.Height; y++)
{
for (int x = 0; x < image.Width; x++)
{
int color = rasterImage.GetArgb32Pixel(x, y);
}
}
stopwatch.Stop();
System.Console.WriteLine("Reading all cached pixels took {0} ms.", stopwatch.ElapsedMilliseconds);
}
// Load an image from a PNG file
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
// Reading all pixels is not as fast as when caching
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
for (int y = 0; y < image.Height; y++)
{
for (int x = 0; x < image.Width; x++)
{
int color = rasterImage.GetArgb32Pixel(x, y);
}
}
stopwatch.Stop();
System.Console.WriteLine("Reading all pixels without preliminary caching took {0} ms.", stopwatch.ElapsedMilliseconds);
}
// The output may look like this:
// Reading all cached pixels took 1500 ms.
// Reading all pixels without preliminary caching took 150000 ms.
GetDefaultArgb32Pixels(Rectangle)
기본 32비트 ARGB 픽셀 배열을 얻습니다.
public int[] GetDefaultArgb32Pixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
픽셀을 얻을 수있는 직경.
Returns
int [ ] [ [ ]
지정된 픽셀은 아레이입니다.
GetDefaultPixels(오른쪽, IPartialArgb32PixelLoader)
기본 픽셀을 부분 픽셀 충전기를 사용하여 배열합니다.
public void GetDefaultPixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)
Parameters
rectangle
Rectangle
픽셀을 얻을 수있는 직경.
partialPixelLoader
IPartialArgb32PixelLoader
부분적인 픽셀 충전기
GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawData설정)
기본 원료 데이터 레이어를 부분 픽셀 충전기를 사용하여 얻습니다.
public void GetDefaultRawData(Rectangle rectangle, IPartialRawDataLoader partialRawDataLoader, RawDataSettings rawDataSettings)
Parameters
rectangle
Rectangle
픽셀을 얻을 수있는 직경.
partialRawDataLoader
IPartialRawDataLoader
부분적인 원료 데이터 충전기
rawDataSettings
RawDataSettings
원료 데이터 설정
GetDefaultRawData(원제 : RawDataSettings)
기본 원료 데이터를 얻습니다.
public byte[] GetDefaultRawData(Rectangle rectangle, RawDataSettings rawDataSettings)
Parameters
rectangle
Rectangle
원료 데이터를 얻을 수있는 직경.
rawDataSettings
RawDataSettings
원료 데이터 설정
Returns
byte [ ] [ [ ]
기본적으로 원료 데이터를 제공합니다.
GetModifyDate(바울)
리소스 이미지가 마지막으로 수정된 날짜와 시간을 얻습니다.
public virtual DateTime GetModifyDate(bool useDefault)
Parameters
useDefault
bool
‘진실’으로 설정하면 FileInfo의 정보를 기본 값으로 사용합니다.
Returns
리소스 이미지의 날짜와 시간이 마지막으로 수정되었습니다.
GetPixel(이트, 이트)
이미지 픽셀을 얻습니다.
public Color GetPixel(int x, int y)
Parameters
x
int
픽셀 x 위치
y
int
픽셀 및 위치
Returns
지정된 위치에 대한 픽셀 색상.
Examples
다음 예제는 라스터 이미지를 업로드하고 자발적인 픽셀의 색상을 얻습니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get the color of the top-left pixel of the image.
Color color = rasterImage.GetPixel(0, 0);
// Obtain the values of the individual color components
byte alpha = color.A;
byte red = color.R;
int green = color.G;
int blue = color.B;
System.Console.WriteLine("The color of the pixel(0,0) is A={0},R={1},G={2},B={3}", alpha, red, green, blue);
}
GetSkewAngle()
스카이 링을 얻으십시오.이 방법은 스캔 된 텍스트 문서에 적용되며, 스캔 할 때 스케이 각도를 결정합니다.
public float GetSkewAngle()
Returns
스케치 각도, 등급으로
Grayscale()
그림을 그레이스케일 표현으로 변환
public virtual void Grayscale()
Examples
다음 예제는 녹색 그림을 그레이 스케일로 변환합니다.그레이 스케일 그림은 독점적으로 회색의 그림자로 구성되어 있으며 강도 정보 만 제공됩니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
rasterImage.Grayscale();
rasterImage.Save(dir + "sample.Grayscale.png");
}
LoadArgb32Pixels(Rectangle)
32비트 ARGB 픽셀을 충전합니다.
public int[] LoadArgb32Pixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽으로부터 픽셀을 충전합니다.
Returns
int [ ] [ [ ]
충전된 32비트 ARGB 픽셀 레이어.
Examples
다음 예제는 레이더 이미지의 픽셀을 충전하고 처리하는 방법을 보여줍니다. 픽셀은 32 비트 전체 값으로 표현됩니다. 예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadArgb32Pixels method.
int[] pixels = rasterImage.LoadArgb32Pixels(rasterImage.Bounds);
int count = 0;
foreach (int pixel in pixels)
{
int alpha = (pixel >> 24) & 0xff;
if (alpha == 0)
{
count++;
}
}
System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
LoadArgb64Pixels(Rectangle)
64비트 ARGB 픽셀을 충전합니다.
public long[] LoadArgb64Pixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽으로부터 픽셀을 충전합니다.
Returns
long [ ] [ [ ]
64비트 ARGB 픽셀 배치.
Examples
다음 예제는 라스터 이미지의 픽셀을 충전하고 처리하는 방법을 보여줍니다. 픽셀은 64 비트 전체 값으로 표현됩니다. 예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\16rgba.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadArgb64Pixels method.
// Note that the image itself must have 16 bits per sample, because Aspose.Imaging.RasterImage.LoadArgb64Pixels doesn't work with 8 bit per sample.
// In order to work with 8 bits per sample please use the good old Aspose.Imaging.RasterImage.LoadArgb32Pixels method.
long[] pixels = rasterImage.LoadArgb64Pixels(rasterImage.Bounds);
int count = 0;
foreach (int pixel in pixels)
{
// Note that all color components including alpha are represented by 16-bit values, so their allowed values are in the range [0, 63535].
int alpha = (pixel >> 48) & 0xffff;
if (alpha == 0)
{
count++;
}
}
System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
LoadCmyk32Pixels(Rectangle)
픽셀을 CMYK 형식으로 충전합니다.
public int[] LoadCmyk32Pixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽으로부터 픽셀을 충전합니다.
Returns
int [ ] [ [ ]
충전된 CMYK 픽셀은 32비트 inateger 값으로 제공됩니다.
LoadCmykPixels(Rectangle)
픽셀을 CMYK 형식으로 충전합니다.이 방법은 약화되어 있습니다. Aspose.Imaging.RasterImage.LoadCmyk32Pixels(Aspose.Imaging.Rectangle) 방법을 더 효과적으로 사용하십시오.
[Obsolete("Method is obsolete")]
public CmykColor[] LoadCmykPixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽으로부터 픽셀을 충전합니다.
Returns
CmykColor [ ] [ [ ]
충전된 CMYK 픽셀을 배치합니다.
LoadPartialArgb32Pixels(오른쪽, IPartialArgb32PixelLoader)
32비트 ARGB 픽셀을 부분적으로 패키지로 충전합니다.
public void LoadPartialArgb32Pixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)
Parameters
rectangle
Rectangle
원하는 오른쪽 쪽.
partialPixelLoader
IPartialArgb32PixelLoader
32비트 ARGB 픽셀 충전기
Examples
예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오. 부분 충전 메커니즘을 사용하여 투명한 픽셀을 계산하려면, Aspose.Imaging.IPartialArgb32PixelLoader를 구현하는 분리 클래스 TransparentArgb32PixelCounter가 도입됩니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Create an instance of the Aspose.Imaging.IPartialArgb32PixelLoader and pass it to the Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels
TransparentArgb32PixelCounter counter = new TransparentArgb32PixelCounter();
// Load pixels for the whole image. Any rectangular part of the image can be specified as the first parameter of the Aspose.Imaging.RasterImage.LoadPartialArgb32Pixels method.
rasterImage.LoadPartialArgb32Pixels(rasterImage.Bounds, counter);
System.Console.WriteLine("The number of fully transparent pixels is {0}", counter.Count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
// The counter may look like this:
/// <summary>
/// Counts the number of fully transparent pixels with alpha channel value of 0.
/// </summary>
private class TransparentArgb32PixelCounter : IPartialArgb32PixelLoader
{
/// <summary>
/// The number of fully transparent pixels.
/// </summary>
private int count;
/// <summary>
/// Gets the number of fully transparent pixels.
/// </summary>
public int Count
{
get { return this.count; }
}
/// <summary>
/// Processes the loaded pixels. This method is called back every time when a new portion of pixels is loaded.
/// </summary>
/// <param name="pixelsRectangle"/>The pixels rectangle.
/// <param name="pixels"/>The 32-bit ARGB pixels.
/// <param name="start"/>The start pixels point.
/// <param name="end"/>The end pixels point.
public void Process(Aspose.Imaging.Rectangle pixelsRectangle, int[] pixels, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
{
foreach (int pixel in pixels)
{
int alpha = (pixel >> 24) & 0xff;
if (alpha == 0)
{
this.count++;
}
}
}
}
LoadPartialArgb64Pixels(오른쪽, IPartialArgb64PixelLoader)
64비트 ARGB 픽셀을 부분적으로 패키지로 충전합니다.
public void LoadPartialArgb64Pixels(Rectangle rectangle, IPartialArgb64PixelLoader partialPixelLoader)
Parameters
rectangle
Rectangle
원하는 오른쪽 쪽.
partialPixelLoader
IPartialArgb64PixelLoader
64비트 ARGB 픽셀 충전기
LoadPartialPixels(Rectangle 및 IPartialPixelLoader)
픽셀을 부분적으로 패키지로 충전합니다.
public void LoadPartialPixels(Rectangle desiredRectangle, IPartialPixelLoader pixelLoader)
Parameters
desiredRectangle
Rectangle
원하는 오른쪽 쪽.
pixelLoader
IPartialPixelLoader
픽셀 충전기
Examples
다음 예제는 자신의 부분 프로세서를 사용하여 라스터 이미지의 픽셀을 충전하고 처리하는 방법을 보여줍니다. 예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오. 부분 충전 메커니즘을 사용하여 투명한 픽셀을 계산하려면 Aspose.Imaging.IPartialPixelLoader를 구현하는 분리 된 클래스 TransparentPixelCounter가 도입됩니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Create an instance of the Aspose.Imaging.IPartialPixelLoader and pass it to the Aspose.Imaging.RasterImage.LoadPartialPixels
TransparentPixelCounter counter = new TransparentPixelCounter();
// Load pixels for the whole image. Any rectangular part of the image can be specified as the first parameter of the Aspose.Imaging.RasterImage.LoadPartialPixels method.
rasterImage.LoadPartialPixels(rasterImage.Bounds, counter);
System.Console.WriteLine("The number of fully transparent pixels is {0}", counter.Count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
// The counter may look like this:
/// <summary>
/// Counts the number of fully transparent pixels with alpha channel value of 0.
/// </summary>
private class TransparentPixelCounter : IPartialPixelLoader
{
/// <summary>
/// The number of fully transparent pixels.
/// </summary>
private int count;
/// <summary>
/// Gets the number of fully transparent pixels.
/// </summary>
public int Count
{
get { return this.count; }
}
/// <summary>
/// Processes the loaded pixels. This method is called back every time when a new portion of pixels is loaded.
/// </summary>
/// <param name="pixelsRectangle"/>The pixels rectangle.
/// <param name="pixels"/>The 32-bit ARGB pixels.
/// <param name="start"/>The start pixels point.
/// <param name="end"/>The end pixels point.
public void Process(Aspose.Imaging.Rectangle pixelsRectangle, Aspose.Imaging.Color[] pixels, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
{
foreach (Color pixel in pixels)
{
if (pixel.A == 0)
{
this.count++;
}
}
}
}
LoadPixels(Rectangle)
픽셀을 충전합니다.
public Color[] LoadPixels(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽으로부터 픽셀을 충전합니다.
Returns
Color [ ] [ [ ]
충전된 픽셀이 쌓여 있습니다.
Examples
다음 예제는 레이더 이미지의 픽셀을 충전하고 처리하는 방법을 보여줍니다.예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\alpha.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadPixels method.
Color[] pixels = rasterImage.LoadPixels(rasterImage.Bounds);
int count = 0;
foreach (Color pixel in pixels)
{
if (pixel.A == 0)
{
count++;
}
}
System.Console.WriteLine("The number of fully transparent pixels is {0}", count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
이 예제는 유형 색상 범위에서 픽셀 정보를 업로드하는 방법을 보여주고, 범위를 조작하고 이미지로 다시 설정합니다.이 작업을 수행하려면 이 예제는 새로운 이미지 파일 (GIF 형식) uisng MemoryStream 개체를 생성합니다.
//Create an instance of MemoryStream
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
//Create an instance of GifOptions and set its various properties including the Source property
Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
{
//Get the pixels of image by specifying the area as image boundary
Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);
//Loop over the Array and sets color of alrenative indexed pixel
for (int index = 0; index < pixels.Length; index++)
{
if (index % 2 == 0)
{
//Set the indexed pixel color to yellow
pixels[index] = Aspose.Imaging.Color.Yellow;
}
else
{
//Set the indexed pixel color to blue
pixels[index] = Aspose.Imaging.Color.Blue;
}
}
//Apply the pixel changes to the image
image.SavePixels(image.Bounds, pixels);
// save all changes.
image.Save();
}
// Write MemoryStream to File
using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
{
stream.WriteTo(fileStream);
}
}
LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader)
원료 데이터를 충전합니다.
public void LoadRawData(Rectangle rectangle, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)
Parameters
rectangle
Rectangle
원료 데이터를 충전하기위한 직경.
rawDataSettings
RawDataSettings
원료 데이터 설정은 충전된 데이터에 사용됩니다. 데이터가 지정된 형식에 있지 않으면 데이터 변환이 수행됩니다.
rawDataLoader
IPartialRawDataLoader
원료 데이터 충전기
Examples
다음 예제는 RawDataSettings를 사용하여 원료 이미지 데이터에서 픽셀을 추출하는 방법을 보여줍니다.예를 들어, 이미지의 완전히 투명한 픽셀을 계산하는 문제를 고려하십시오.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\GrayscaleWithAlpha.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
Aspose.Imaging.RawDataSettings settings = rasterImage.RawDataSettings;
TransparentPixelRawDataCounter rawDataLoader = new TransparentPixelRawDataCounter(settings);
// Load pixels for the whole image. Any rectangular part of the image can be specified as a parameter of the Aspose.Imaging.RasterImage.LoadRawData method.
rasterImage.LoadRawData(rasterImage.Bounds, settings, rawDataLoader);
System.Console.WriteLine("The number of fully transparent pixels is {0}", rawDataLoader.Count);
System.Console.WriteLine("The total number of pixels is {0}", image.Width * image.Height);
}
// In case of raw data, the counter may look like this:
/// <summary>
/// Counts the number of fully transparent pixels with alpha channel value of 0.
/// </summary>
private class TransparentPixelRawDataCounter : IPartialRawDataLoader
{
/// <summary>
/// The number of fully transparent pixels.
/// </summary>
private int count;
/// <summary>
/// The raw data settings of the loaded image.
/// </summary>
private Aspose.Imaging.RawDataSettings rawDataSettings;
/// <summary>
/// Gets the number of fully transparent pixels.
/// </summary>
public int Count
{
get { return this.count; }
}
/// <summary>
/// Initializes a new instance of the <see transparentpixelrawdatacounter=""></see> class.
/// </summary>
/// <param name="settings"/>The raw data settings allow to extract color components from raw data.
public TransparentPixelRawDataCounter(Aspose.Imaging.RawDataSettings settings)
{
this.rawDataSettings = settings;
this.count = 0;
}
/// <summary>
/// Processes the loaded raw data. This method is called back every time when a new portion of raw data is loaded.
/// </summary>
/// <param name="dataRectangle"/>The raw data rectangle.
/// <param name="data"/>The raw data.
/// <param name="start"/>The start data point.
/// <param name="end"/>The end data point.
public void Process(Aspose.Imaging.Rectangle dataRectangle, byte[] data, Aspose.Imaging.Point start, Aspose.Imaging.Point end)
{
int[] channelBits = this.rawDataSettings.PixelDataFormat.ChannelBits;
// Only simple formats are consdired here to simplify the code.
// Let's consider only images with 8 bits per sample.
for (int i = 0; i < channelBits.Length; i++)
{
if (channelBits[i] != 8)
{
throw new System.NotSupportedException();
}
}
switch (this.rawDataSettings.PixelDataFormat.PixelFormat)
{
case PixelFormat.Rgb:
case PixelFormat.Bgr:
{
if (channelBits.Length == 4)
{
// ARGB
for (int i = 0; i < data.Length; i += 4)
{
// The alpha channel is stored last, after the color components.
if (data[i + 3] == 0)
{
this.count++;
}
}
}
}
break;
case PixelFormat.Grayscale:
{
if (channelBits.Length == 2)
{
// Grayscale Alpha
for (int i = 0; i < data.Length; i += 2)
{
// The alpha channel is stored last, after the color components.
if (data[i + 1] == 0)
{
this.count++;
}
}
}
}
break;
default:
throw new System.ArgumentOutOfRangeException("PixelFormat");
}
}
/// <summary>
/// Processes the loaded raw data. This method is called back every time when a new portion of raw data is loaded.
/// </summary>
/// <param name="dataRectangle"/>The raw data rectangle.
/// <param name="data"/>The raw data.
/// <param name="start"/>The start data point.
/// <param name="end"/>The end data point.
/// <param name="loadOptions"/>The load options.
public void Process(Aspose.Imaging.Rectangle dataRectangle, byte[] data, Aspose.Imaging.Point start, Aspose.Imaging.Point end, Aspose.Imaging.LoadOptions loadOptions)
{
this.Process(dataRectangle, data, start, end);
}
}
LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader)
원료 데이터를 충전합니다.
public void LoadRawData(Rectangle rectangle, Rectangle destImageBounds, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)
Parameters
rectangle
Rectangle
원료 데이터를 충전하기위한 직경.
destImageBounds
Rectangle
이미지가 제한되어 있습니다.
rawDataSettings
RawDataSettings
원료 데이터 설정은 충전된 데이터에 사용됩니다. 데이터가 지정된 형식에 있지 않으면 데이터 변환이 수행됩니다.
rawDataLoader
IPartialRawDataLoader
원료 데이터 충전기
NormalizeAngle()
각도를 정상화합니다.이 방법은 스캔 된 스캔을 제거하기 위해 스캔 된 텍스트 문서에 적용됩니다.이 방법은 Aspose.Imaging.RasterImage.GetSkewAngle 및 Aspose.Imaging.RasterImage.Rotate(System.Single) 방법을 사용합니다.
public void NormalizeAngle()
NormalizeAngle(바울, 색상)
각도를 정상화합니다.이 방법은 스캔 된 스캔을 제거하기 위해 스캔 된 텍스트 문서에 적용됩니다.이 방법은 Aspose.Imaging.RasterImage.GetSkewAngle 및 Aspose.Imaging.RasterImage.Rotate(System.Single,System.Boolean,Aspose.Imaging.Color) 방법을 사용합니다.
public virtual void NormalizeAngle(bool resizeProportionally, Color backgroundColor)
Parameters
resizeProportionally
bool
‘진실’으로 설정하면 이미지 크기가 회전 된 직경 (구석 지점) 프로젝션에 따라 변경되며, 다른 경우에는 차원을 만지지 않고 내부 이미지 콘텐츠만 회전됩니다.
backgroundColor
Color
배경의 색깔.
Examples
Skew는 문서 검사 과정에서 문서의 텍스트 / 이미지가 가벼운 각도에서 회전 될 때 나타날 수있는 유물입니다.그것은 여러 가지 원인이있을 수 있지만 가장 일반적인 것은 스캔 중에 종이가 잘못 위치를 얻는 것입니다.그러므로, deskew는 스캔 된 파일(즉, bitmap)에이 문제를 감지하고 수정하는 과정입니다 그래서 deskewed 문서는 텍스트 / 이미지가 올바르게 수평으로 조정됩니다.
string dir = "c:\\aspose.imaging\\issues\\net\\3567\\";
string inputFilePath = dir + "skewed.png";
string outputFilePath = dir + "skewed.out.png";
// Get rid of the skewed scan with default parameters
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(inputFilePath))
{
// Deskew
image.NormalizeAngle(false /*do not resize*/, Aspose.Imaging.Color.LightGray /*background color*/);
image.Save(outputFilePath);
}
NormalizeHistogram()
이미지 histogram을 정상화 - 모든 사용 가능한 범위를 사용하기 위해 픽셀 값을 조정합니다.
public virtual void NormalizeHistogram()
ReadArgb32ScanLine(이트)
전체 스캔 라인을 지정된 스캔 라인 인덱스로 읽습니다.
public int[] ReadArgb32ScanLine(int scanLineIndex)
Parameters
scanLineIndex
int
스캔 라인의 0 기반 인덱스.
Returns
int [ ] [ [ ]
스캔 라인은 32 비트 ARGB 색상 값을 배열합니다.
ReadScanLine(이트)
전체 스캔 라인을 지정된 스캔 라인 인덱스로 읽습니다.
public Color[] ReadScanLine(int scanLineIndex)
Parameters
scanLineIndex
int
스캔 라인의 0 기반 인덱스.
Returns
Color [ ] [ [ ]
스캔 라인 픽셀 색상 값을 배열합니다.
ReleaseManagedResources()
관리된 자원을 풀어주십시오. 관리되지 않은 자원이 여기에서 풀어주지 않도록하십시오.이 자원은 이미 풀어주었을 수도 있기 때문에.
protected override void ReleaseManagedResources()
RemoveMetadata()
이 이미지 샘플 메타 데이터를 제거하여 이 Aspose.Imaging.Xmp.IHasXMPData. 0 0 0 0.
public override void RemoveMetadata()
ReplaceColor(색상, 바이트, 색상)
허용되는 차이로 한 색을 다른 색으로 대체하고 원래 알파 값을 유지하여 부드러운 경계를 저장합니다.
public void ReplaceColor(Color oldColor, byte oldColorDiff, Color newColor)
Parameters
oldColor
Color
오래된 색상이 대체됩니다.
oldColorDiff
byte
오래된 색상의 차이가 대체 색상 톤을 확장 할 수 있도록 허용되었습니다.
newColor
Color
새로운 색상으로 오래된 색상을 대체합니다.
ReplaceColor(이트, 바이트, 이트)
허용되는 차이로 한 색을 다른 색으로 대체하고 원래 알파 값을 유지하여 부드러운 경계를 저장합니다.
public virtual void ReplaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Parameters
oldColorArgb
int
오래된 색상 ARGB 값이 대체됩니다.
oldColorDiff
byte
오래된 색상의 차이가 대체 색상 톤을 확장 할 수 있도록 허용되었습니다.
newColorArgb
int
새로운 색상 ARGB 값은 오래된 색상을 대체합니다.
ReplaceNonTransparentColors(Color)
모든 투명하지 않은 색상을 새 색으로 대체하고 원래 알파 값을 유지하여 부드러운 경계를 저장합니다.참고: 투명성이 없는 이미지에서 사용하면 모든 색상이 하나로 대체됩니다.
public void ReplaceNonTransparentColors(Color newColor)
Parameters
newColor
Color
새로운 색상은 투명하지 않은 색상으로 대체됩니다.
ReplaceNonTransparentColors(이트)
모든 투명하지 않은 색상을 새 색으로 대체하고 원래 알파 값을 유지하여 부드러운 경계를 저장합니다.참고: 투명성이 없는 이미지에서 사용하면 모든 색상이 하나로 대체됩니다.
public virtual void ReplaceNonTransparentColors(int newColorArgb)
Parameters
newColorArgb
int
새로운 색상 ARGB 값은 투명하지 않은 색상을 대체합니다.
Resize(이트, 이트, ImageResizeSettings)
확장된 옵션으로 이미지를 재시작합니다.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
int
새로운 광도 입니다.
newHeight
int
새로운 높이 입니다.
settings
ImageResizeSettings
재구성 설정에 대하여
Examples
이 예제는 라스터 이미지를 업로드하고 다양한 리시딩 설정을 사용하여 재시작합니다.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageResizeSettings resizeSettings = new Aspose.Imaging.ImageResizeSettings();
// The adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation.
resizeSettings.Mode = Aspose.Imaging.ResizeType.AdaptiveResample;
// The small rectangular filter
resizeSettings.FilterType = Aspose.Imaging.ImageFilterType.SmallRectangular;
// The number of colors in the palette.
resizeSettings.EntriesCount = 256;
// The color quantization is not used
resizeSettings.ColorQuantizationMethod = ColorQuantizationMethod.None;
// The euclidian method
resizeSettings.ColorCompareMethod = ColorCompareMethod.Euclidian;
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
// Scale down by 2 times using adaptive resampling.
image.Resize(image.Width / 2, image.Height / 2, resizeSettings);
image.Save(dir + "downsample.adaptive.gif");
}
Rotate(플로트, 볼, 색상)
센터 주위에 사진을 회전합니다.
public virtual void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
긍정적 값은 시계로 회전합니다.
resizeProportionally
bool
‘진실’으로 설정하면 이미지 크기가 회전 된 직경 (구석 지점) 프로젝션에 따라 변경되며, 다른 경우에는 차원을 만지지 않고 내부 이미지 콘텐츠만 회전됩니다.
backgroundColor
Color
배경의 색깔.
Exceptions
실행되지 않은 예외
Rotate(플로트)
센터 주위에 사진을 회전합니다.
public override void Rotate(float angle)
Parameters
angle
float
긍정적 값은 시계로 회전합니다.
Save(흐름, ImageOptionsBase, Rectangle)
저장 옵션에 따라 지정된 파일 형식에서 지정된 스트림으로 이미지 데이터를 저장합니다.
public override void Save(Stream stream, ImageOptionsBase optionsBase, Rectangle boundsRectangle)
Parameters
stream
Stream
흐름은 이미지의 데이터를 저장합니다.
optionsBase
ImageOptionsBase
저축 옵션
boundsRectangle
Rectangle
목적지 이미지는 직경을 제한합니다. 출처 제한을 사용하기 위해 빈 직경을 설정합니다.
SaveArgb32Pixels(오른쪽, int[])
32비트 ARGB 픽셀을 저장합니다.
public void SaveArgb32Pixels(Rectangle rectangle, int[] pixels)
Parameters
rectangle
Rectangle
픽셀을 저장할 수 있는 직경.
pixels
int
[ ] [ [ ]
32비트 ARGB 픽셀을 배치합니다.
Examples
다음 예제는 Aspose.Imaging.RasterImage.SaveArgb32Pixels 방법을 사용하여 라스터 이미지의 중앙 영역을 검은 픽셀로 채워줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// The black square
int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.Black.ToArgb();
}
// Draw the black square at the center of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SaveArgb32Pixels(area, pixels);
rasterImage.Save(dir + "sample.SaveArgb32Pixels.png");
}
SaveCmyk32Pixels(오른쪽, int[])
픽셀을 저장합니다.
public void SaveCmyk32Pixels(Rectangle rectangle, int[] pixels)
Parameters
rectangle
Rectangle
픽셀을 저장할 수 있는 직경.
pixels
int
[ ] [ [ ]
CMYK 픽셀은 32비트 전체 값으로 표시됩니다.
Examples
다음 예제는 Aspose.Imaging.RasterImage.SaveCmyk32Pixels 방법을 사용하여 라스터 이미지의 중앙 영역을 검은 픽셀로 채워줍니다.
string dir = @"c:\temp\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get an integer representation of black in the CMYK color space.
int blackCmyk = Aspose.Imaging.CmykColorHelper.ToCmyk(Color.Black);
// The black square.
int[] pixels = new int[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = blackCmyk;
}
// Draw the black square at the center of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SaveCmyk32Pixels(area, pixels);
rasterImage.Save(dir + "sample.SaveCmyk32Pixels.png");
}
SaveCmykPixels(오른쪽, CmykColor[])
픽셀을 저장합니다.Aspose.Imaging.RasterImage.SaveCmyk32Pixels(Aspose.Imaging.Rectangle,System.Int32[]) 방법을 더 효과적으로 사용하십시오.
[Obsolete("Method is obsolete")]
public void SaveCmykPixels(Rectangle rectangle, CmykColor[] pixels)
Parameters
rectangle
Rectangle
픽셀을 저장할 수 있는 직경.
pixels
CmykColor
[ ] [ [ ]
CMYK 픽셀이 정렬됩니다.
SavePixels(오른쪽, 색상[])
픽셀을 저장합니다.
public void SavePixels(Rectangle rectangle, Color[] pixels)
Parameters
rectangle
Rectangle
픽셀을 저장할 수 있는 직경.
pixels
Color
[ ] [ [ ]
픽셀이 흔들리고 있다.
Examples
다음 예제는 Aspose.Imaging.RasterImage.SavePixels 방법을 사용하여 블랙 픽셀으로 라스터 이미지의 중앙 영역을 채우고 있습니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// The black square
Color[] pixels = new Color[(rasterImage.Width / 2) * (rasterImage.Height / 2)];
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = Color.Black;
}
// Draw the black square at the center of the image.
Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
rasterImage.SavePixels(area, pixels);
rasterImage.Save(dir + "sample.SavePixels.png");
}
이 예제는 유형 색상 범위에서 픽셀 정보를 업로드하는 방법을 보여주고, 범위를 조작하고 이미지로 다시 설정합니다.이 작업을 수행하려면 이 예제는 새로운 이미지 파일 (GIF 형식) uisng MemoryStream 개체를 생성합니다.
//Create an instance of MemoryStream
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
//Create an instance of GifOptions and set its various properties including the Source property
Aspose.Imaging.ImageOptions.GifOptions gifOptions = new Aspose.Imaging.ImageOptions.GifOptions();
gifOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);
//Create an instance of Image
using (Aspose.Imaging.RasterImage image = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(gifOptions, 500, 500))
{
//Get the pixels of image by specifying the area as image boundary
Aspose.Imaging.Color[] pixels = image.LoadPixels(image.Bounds);
//Loop over the Array and sets color of alrenative indexed pixel
for (int index = 0; index < pixels.Length; index++)
{
if (index % 2 == 0)
{
//Set the indexed pixel color to yellow
pixels[index] = Aspose.Imaging.Color.Yellow;
}
else
{
//Set the indexed pixel color to blue
pixels[index] = Aspose.Imaging.Color.Blue;
}
}
//Apply the pixel changes to the image
image.SavePixels(image.Bounds, pixels);
// save all changes.
image.Save();
}
// Write MemoryStream to File
using (System.IO.FileStream fileStream = new System.IO.FileStream(@"C:\temp\output.gif", System.IO.FileMode.Create))
{
stream.WriteTo(fileStream);
}
}
SaveRawData(바이트[ ] [ [ ], int, Rectangle, RawData설정)
원료 데이터를 저장합니다.
public void SaveRawData(byte[] data, int dataOffset, Rectangle rectangle, RawDataSettings rawDataSettings)
Parameters
data
byte
[ ] [ [ ]
원료 데이터 입니다.
dataOffset
int
초기 원료 데이터가 납부됩니다.
rectangle
Rectangle
원료 데이터 직경.
rawDataSettings
RawDataSettings
원료 데이터는 데이터가 들어있는 설정입니다.
SetArgb32Pixel(인, 인, 인)
지정된 위치에 대한 32비트 ARGB 픽셀의 이미지를 설정합니다.
public void SetArgb32Pixel(int x, int y, int argb32Color)
Parameters
x
int
픽셀 x 위치
y
int
픽셀 및 위치
argb32Color
int
지정된 위치를 위한 32비트 ARGB 픽셀.
Examples
다음 예제는 라스터 이미지를 업로드하고 자발적인 픽셀의 색상을 설정합니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Sets the color of the top-left pixel.
rasterImage.SetArgb32Pixel(0, 0, Aspose.Imaging.Color.Aqua.ToArgb());
// Another way is to pass an instance of the Aspose.Imaging.Color directly
rasterImage.SetPixel(0, 0, Aspose.Imaging.Color.Aqua);
}
SetPalette(바이올린, 바이올린)
이미지 팔레트를 설정합니다.
public override void SetPalette(IColorPalette palette, bool updateColors)
Parameters
palette
IColorPalette
팔레트를 설정합니다.
updateColors
bool
‘진짜’ 색상으로 설정하면 새 패널에 따라 업데이트됩니다; 그렇지 않으면 색상 지수는 변하지 않습니다.
SetPixel(인트, 인트, 색상)
지정된 위치에 대한 이미지 픽셀을 설정합니다.
public void SetPixel(int x, int y, Color color)
Parameters
x
int
픽셀 x 위치
y
int
픽셀 및 위치
color
Color
지정된 위치에 대한 픽셀 색상.
Examples
다음 예제는 라스터 이미지를 업로드하고 자발적인 픽셀의 색상을 설정합니다.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"c:\temp\sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Sets the color of the top-left pixel.
rasterImage.SetArgb32Pixel(0, 0, Aspose.Imaging.Color.Aqua.ToArgb());
// Another way is to pass an instance of the Aspose.Imaging.Color directly
rasterImage.SetPixel(0, 0, Aspose.Imaging.Color.Aqua);
}
SetResolution(더블, 더블)
이 Aspose.Imaging.RasterImage에 대한 해상도를 설정합니다.
public virtual void SetResolution(double dpiX, double dpiY)
Parameters
dpiX
double
Aspose.Imaging.RasterImage의 수평 해상도, 인치 당 포인트.
dpiY
double
Aspose.Imaging.RasterImage의 수직 해상도, 인치 당 포인트.
Examples
다음 예제는 라스터 이미지의 수평 / 수직 해상도를 설정하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// Get horizontal and vertical resolution of the image
double horizontalResolution = rasterImage.HorizontalResolution;
double verticalResolution = rasterImage.VerticalResolution;
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", horizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", verticalResolution);
if (horizontalResolution != 96.0 || verticalResolution != 96.0)
{
// Use the SetResolution method for updating both resolution values in a single call.
System.Console.WriteLine("Set resolution values to 96 dpi");
rasterImage.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", rasterImage.HorizontalResolution);
System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", rasterImage.VerticalResolution);
}
// The output may look like this:
// The horizontal resolution, in pixels per inch: 300
// The vertical resolution, in pixels per inch: 300
// Set resolution values to 96 dpi
// The horizontal resolution, in pixels per inch: 96
// The vertical resolution, in pixels per inch: 96
}
ToBitmap()
라스터 이미지를 bitmap로 변환합니다.이 방법은 .Net7.0 이상의 버전에서 지원되지 않습니다.
public virtual Bitmap ToBitmap()
Returns
비트마프
UpdateDimensions(이트, 이트)
이미지 차원을 업데이트합니다.
protected abstract void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
새로운 이미지 폭.
newHeight
int
새로운 이미지 높이.
UpdateMetadata()
이미지 메타 데이터를 업데이트합니다.
protected virtual void UpdateMetadata()
WriteArgb32ScanLine(이트, 이트[])
전체 스캔 라인을 지정된 스캔 라인 인덱스에 입력합니다.
public void WriteArgb32ScanLine(int scanLineIndex, int[] argb32Pixels)
Parameters
scanLineIndex
int
스캔 라인의 0 기반 인덱스.
argb32Pixels
int
[ ] [ [ ]
32비트 ARGB 색상은 글을 쓸 수 있습니다.
WriteScanLine(색상, 색상[])
전체 스캔 라인을 지정된 스캔 라인 인덱스에 입력합니다.
public void WriteScanLine(int scanLineIndex, Color[] pixels)
Parameters
scanLineIndex
int
스캔 라인의 0 기반 인덱스.
pixels
Color
[ ] [ [ ]
픽셀 색상은 글을 쓸 수 있습니다.