Class TiffFrame
이름 공간 : Aspose.Imaging.FileFormats.Tiff 모임: Aspose.Imaging.dll (25.4.0)
티프 프레임
[JsonObject(MemberSerialization.OptIn)]
public sealed class TiffFrame : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasExifData, IHasXmpData, IHasMetadata
Inheritance
object ← DisposableObject ← DataStreamSupporter ← Image ← RasterImage ← RasterCachedImage ← TiffFrame
Implements
IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasExifData , 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.IsCached , 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.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 , 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.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.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
이 예제는 스크래치에서 TIFF 이미지를 만드는 방법을 보여주고 파일에 저장합니다.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Set the RGB color model.
createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// All color components will be stored within a single plane.
createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create a TIFF Frame of 100x100 px.
// Note that you don't have to dispose a frame explicitly if it is included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
// Fill the entire frame with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
// Create a TIFF image.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
{
tiffImage.Save(dir + "output.tif");
}
Constructors
TiffFrame(Stream)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(Stream stream)
Parameters
stream
Stream
흐름에서 이미지를 업로드하고 프레임 픽셀과 팔레트 데이터를 시작합니다.
TiffFrame(흐름, TiffOptions)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(Stream stream, TiffOptions options)
Parameters
stream
Stream
흐름에서 이미지를 업로드하고 프레임 픽셀과 팔레트 데이터를 시작합니다.
options
TiffOptions
새로 만들어진 프레임에 사용할 수있는 옵션.
TiffFrame(스트리트)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(string path)
Parameters
path
string
그림을 로드하고 프레임 픽셀과 팔레트 데이터를 시작하는 경로.
TiffFrame(링크, TiffOptions)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(string path, TiffOptions options)
Parameters
path
string
그림을 로드하고 프레임 픽셀과 팔레트 데이터를 시작하는 경로.
options
TiffOptions
새로 만들어진 프레임에 사용할 수있는 옵션.
TiffFrame(RasterImage)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(RasterImage image)
Parameters
image
RasterImage
그림은 프레임 픽셀과 팔레트 데이터를 시작합니다.
Examples
다음 예제는 각각의 래스터 이미지에서 TIFF 조립을 구성하는 방법을 보여줍니다.
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource("c:\\temp\\multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// This is Font and Brush for drawing text on individual frames.
Aspose.Imaging.Font font = new Aspose.Imaging.Font("Arial", 64);
Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.White);
// Create 5 frames
for (int i = 1; i <= 5; i++)
{
Aspose.Imaging.ImageOptions.PngOptions createPngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
createPngOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
// Create a PNG image and draw the number of page on it.
Aspose.Imaging.FileFormats.Png.PngImage pngImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(createPngOptions, 100, 100);
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
gr.DrawString(i.ToString(), font, brush, 10, 10);
// Create a frame based on the PNG image.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(pngImage);
// Add the frame to the TIFF image.
tiffImage.AddFrame(frame);
}
// The image was created with a single default frame. Let's remove it.
Aspose.Imaging.FileFormats.Tiff.TiffFrame activeFrame = tiffImage.ActiveFrame;
tiffImage.ActiveFrame = tiffImage.Frames[1];
tiffImage.RemoveFrame(0);
// Don't forget to dispose the frame if you won't add it to some other TiffImage
activeFrame.Dispose();
tiffImage.Save();
}
TiffFrame(라스테리 이미지, TiffOptions)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(RasterImage image, TiffOptions options)
Parameters
image
RasterImage
그림은 프레임 픽셀과 팔레트 데이터를 시작합니다.
options
TiffOptions
새로 만들어진 프레임에 사용할 수있는 옵션.
TiffFrame(티프옵션, int, int)
Aspose.Imaging.FileFormats.Tiff.TiffFrame 클래스의 새로운 예를 시작합니다.
public TiffFrame(TiffOptions options, int width, int height)
Parameters
options
TiffOptions
프레임 옵션
width
int
넓은 넓은
height
int
높이에 대하여
Examples
이 예제는 스크래치에서 TIFF 이미지를 만드는 방법을 보여주고 파일에 저장합니다.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
createOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
createOptions.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
createOptions.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Set the RGB color model.
createOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// All color components will be stored within a single plane.
createOptions.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create a TIFF Frame of 100x100 px.
// Note that you don't have to dispose a frame explicitly if it is included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
Aspose.Imaging.FileFormats.Tiff.TiffFrame firstFrame = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions, 100, 100);
// Fill the entire frame with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(firstFrame.Width, firstFrame.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(firstFrame);
graphics.FillRectangle(gradientBrush, firstFrame.Bounds);
// Create a TIFF image.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(firstFrame))
{
tiffImage.Save(dir + "output.tif");
}
이 예제는 2 프레임을 가진 TIFF 이미지를 만드는 방법을 보여주고 파일에 저장합니다.
string dir = "c:\\temp\\";
// Options for the first frame
Aspose.Imaging.ImageOptions.TiffOptions createOptions1 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 8 bits for each color component.
createOptions1.BitsPerSample = new ushort[] { 8, 8, 8 };
// Set the Big Endian byte order (Motorola)
createOptions1.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.BigEndian;
// Set the LZW compression.
createOptions1.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.Lzw;
// Set the RGB color model.
createOptions1.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
// All color components will be stored within a single plane.
createOptions1.PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous;
// Create the first TIFF frame of 100x100 px.
// Note that you don't have to dispose frames explicitly if they are included into TiffImage.
// When the container is disposed all frames will be disposed automatically.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame1 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions1, 100, 100);
// Fill the first frame with the blue-yellow gradient.
Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(frame1.Width, frame1.Height),
Aspose.Imaging.Color.Blue,
Aspose.Imaging.Color.Yellow);
Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(frame1);
graphics.FillRectangle(gradientBrush, frame1.Bounds);
// Options for the first frame
Aspose.Imaging.ImageOptions.TiffOptions createOptions2 = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Set 1 bit per pixel for a B/W image.
createOptions2.BitsPerSample = new ushort[] { 1 };
// Set the Little Endian byte order (Intel)
createOptions2.ByteOrder = Aspose.Imaging.FileFormats.Tiff.Enums.TiffByteOrder.LittleEndian;
// Set the CCITT Group 3 Fax compression.
createOptions2.Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.CcittFax3;
// Set the B/W color model where 0 is black, 1 is white.
createOptions2.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
// Create the second TIFF frame of 200x200px.
Aspose.Imaging.FileFormats.Tiff.TiffFrame frame2 = new Aspose.Imaging.FileFormats.Tiff.TiffFrame(createOptions2, 200, 200);
// Fill the second frame with the blue-yellow gradient.
// It will be automatically converted to the B/W format due to the corresponding settings of the frame.
Aspose.Imaging.Graphics graphics2 = new Aspose.Imaging.Graphics(frame2);
graphics2.FillRectangle(gradientBrush, frame2.Bounds);
// Create a TIFF image.
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = new Aspose.Imaging.FileFormats.Tiff.TiffImage(
new Aspose.Imaging.FileFormats.Tiff.TiffFrame[] { frame1, frame2 }))
{
tiffImage.Save(dir + "output.mutliframe.tif");
}
Exceptions
옵션 파라미터는 0입니다.
Properties
BackgroundColor
배경 색상에 대한 가치를 얻거나 설정합니다.
public override Color BackgroundColor { get; set; }
부동산 가치
BitsPerPixel
픽셀 계산에 따라 이미지 비트를 얻습니다.
public override int BitsPerPixel { get; }
부동산 가치
ExifData
프레임에서 EXIF 데이터를 얻거나 설정합니다.
public ExifData ExifData { get; set; }
부동산 가치
FrameOptions
프레임이 옵션을 만듭니다.
public TiffOptions FrameOptions { get; }
부동산 가치
HasAlpha
이 경우 알파가 있는지 여부를 나타내는 값을 얻습니다.
public override bool HasAlpha { get; }
부동산 가치
Examples
다음 예제는 TIFF 이미지를 업로드하고 원료 데이터 형식 및 알파 채널에 대한 정보를 인쇄합니다.
string dir = "c:\\temp\\";
string fileName = dir + "sample.tif";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
// If the active TIFF frame has alpha channel, then the entire TIFF image is considered to have alpha channel.
System.Console.WriteLine("ImageFile={0}, FileFormat={1}, HasAlpha={2}", fileName, tiffImage.RawDataFormat, tiffImage.HasAlpha);
int i = 0;
foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
{
System.Console.WriteLine("Frame={0}, FileFormat={1}, HasAlpha={2}", ++i, frame.RawDataFormat, frame.HasAlpha);
}
}
// The output may look like this:
// ImageFile=c:\temp\sample.tif, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
// Frame=1, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
// Frame=2, FileFormat=RgbIndexed1Bpp, used channels: 1, HasAlpha=False
HasTransparentColor
그림이 투명한 색깔이 있는지 여부를 나타내는 값을 얻습니다.
public override bool HasTransparentColor { get; set; }
부동산 가치
Height
그림의 높이를 얻습니다.
public override int Height { get; }
부동산 가치
HorizontalResolution
이 Aspose.Imaging.RasterImage의 수평 해상도를 픽셀 당 인치로 얻거나 설정합니다.
public override double HorizontalResolution { get; set; }
부동산 가치
Examples
다음 예제는 별도의 TIFF 프레임의 수평/수직 해상도를 설정하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
// Load a TIFF image from a file.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
int i = 0;
foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
{
// Get horizontal and vertical resolution of the TiffFrame.
double horizontalResolution = frame.HorizontalResolution;
double verticalResolution = frame.VerticalResolution;
System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, 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");
frame.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, verticalResolution);
}
++i;
}
}
PathResources
자원을 얻거나 도로를 설정합니다.
public List<pathresource> PathResources { get; set; }
부동산 가치
List <에 대한 정보 PathResource >
Examples
TIFF에서 PSD 이미지로 수출하는 동안 클립 경로를 전송합니다.
using (var image = Image.Load("Sample.tif"))
{
image.Save("SampleWithPaths.psd", new PsdOptions());
}
다음 예제는 TIFF 이미지에서 경로를 추출하고 콘솔에서 그들의 이름을 표시하는 방법을 보여줍니다.
using (var image = (TiffImage)Image.Load("Sample.tif"))
{
foreach (var path in image.ActiveFrame.PathResources)
{
Console.WriteLine(path.Name);
}
}
다음 예제는 이미 존재하는 클립 경로를 변경하는 방법을 보여줍니다.예를 들어, 이미지에 하나의 클립 경로만 보관할 수 있습니다.
using (var image = (TiffImage)Image.Load("Sample.tif"))
{
var paths = image.ActiveFrame.PathResources;
image.ActiveFrame.PathResources = paths.Take(1).ToList();
image.Save();
}
다음 예제는 TIFF 이미지에서 Clipping Path를 만드는 방법을 보여줍니다.이 작업을 수행하려면 PathResource 클래스의 예제를 만드는 것이 필요합니다.이 코드는 TIFF 이미지에서 빈 경로를 만드는 방법을 보여줍니다.
var options = new TiffOptions(TiffExpectedFormat.Default);
var frame = new TiffFrame(options, 800, 600);
using (var image = new TiffImage(frame))
{
image.ActiveFrame.PathResources = new List<pathresource>
{
new PathResource
{
BlockId = 2000,
Name = "My Clipping Path",
Records = new List<vectorpathrecord>()
}
};
image.Save("ImageWithEmptyPath.tiff");
}</vectorpathrecord></pathresource>
Clipping Path를 수동으로 만드십시오.
static void Main()
{
using (var image = (TiffImage)Image.Load("Sample.tif"))
{
image.ActiveFrame.PathResources = new List<pathresource> { new PathResource
{
BlockId = 2000, // Block Id according to Photoshop specification
Name = "My Clipping Path", // Path name
Records = CreateRecords(0.2f, 0.2f, 0.8f, 0.2f, 0.8f, 0.8f, 0.2f, 0.8f) // Create path records using coordinates
}};
image.Save("ImageWithPath.tif");
}
}
private static List<vectorpathrecord> CreateRecords(params float[] coordinates)
{
var records = CreateBezierRecords(coordinates); // Create Bezier records using coordinates
records.Insert(0, new LengthRecord // LengthRecord required by Photoshop specification
{
IsOpen = false, // Lets create closed path
RecordCount = (ushort)records.Count // Record count in the path
});
return records;
}
private static List<vectorpathrecord> CreateBezierRecords(float[] coordinates)
{
return CoordinatesToPoints(coordinates)
.Select(CreateBezierRecord)
.ToList();
}
private static IEnumerable<pointf> CoordinatesToPoints(float[] coordinates)
{
for (var index = 0; index < coordinates.Length; index += 2)
yield return new PointF(coordinates[index], coordinates[index + 1]);
}
private static VectorPathRecord CreateBezierRecord(PointF point)
{
return new BezierKnotRecord { PathPoints = new[] { point, point, point } };
}</pointf></vectorpathrecord></vectorpathrecord></pathresource>
VerticalResolution
이 Aspose.Imaging.RasterImage의 수직 해상도를 픽셀 당 인치로 얻거나 설정합니다.
public override double VerticalResolution { get; set; }
부동산 가치
Examples
다음 예제는 별도의 TIFF 프레임의 수평/수직 해상도를 설정하는 방법을 보여줍니다.
string dir = "c:\\temp\\";
// Load a TIFF image from a file.
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
int i = 0;
foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame frame in tiffImage.Frames)
{
// Get horizontal and vertical resolution of the TiffFrame.
double horizontalResolution = frame.HorizontalResolution;
double verticalResolution = frame.VerticalResolution;
System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, 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");
frame.SetResolution(96.0, 96.0);
System.Console.WriteLine("The horizontal resolution of frame {0}, pixels per inch: {1}", i, horizontalResolution);
System.Console.WriteLine("The vertical resolution, of frame {0}, pixels per inch: {1}", i, verticalResolution);
}
++i;
}
}
Width
이미지를 광범위하게 만듭니다.
public override int Width { get; }
부동산 가치
XmpData
Xmp 데이터를 얻거나 설정합니다.
public override XmpPacketWrapper XmpData { get; set; }
부동산 가치
Methods
AlignResolutions()
수평 및 수직 해상도를 동일하게 만드는 데 도움이되는 방법.
public void AlignResolutions()
CopyFrame(TiffFrame)
전체 프레임을 복사합니다 (두 번 복사합니다).
public static TiffFrame CopyFrame(TiffFrame tiffFrame)
Parameters
tiffFrame
TiffFrame
티프 프레임을 복사합니다.
Returns
새로 복사된 티프 프레임.
CreateFrameFrom(티프프라마, 티프옵션)
지정된 tiffFrame’에서
옵션을 사용하여 프레임을 만듭니다.픽셀 데이터는 보존되지만 원하는 형식으로 변환됩니다.
public static TiffFrame CreateFrameFrom(TiffFrame tiffFrame, TiffOptions options)
Parameters
tiffFrame
TiffFrame
창조할 수 있는 티프 프레임.
options
TiffOptions
사용할 수 있는 새로운 옵션.
Returns
새롭게 만들어진 프레임
Examples
다음 예제는 기존 프레임의 그레이 스케일 복사본을 만드는 방법을 보여주고 TIFF 이미지에 추가합니다.
string dir = "c:\\temp\\";
Aspose.Imaging.ImageOptions.TiffOptions createTiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
// Create a permanent, not temporary file source.
createTiffOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(dir + "multipage.tif", false);
createTiffOptions.Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb;
createTiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Create(createTiffOptions, 100, 100))
{
// The linear gradient from the left-top to the right-bottom corner of the image.
Aspose.Imaging.Brushes.LinearGradientBrush brush =
new Aspose.Imaging.Brushes.LinearGradientBrush(
new Aspose.Imaging.Point(0, 0),
new Aspose.Imaging.Point(tiffImage.Width, tiffImage.Height),
Aspose.Imaging.Color.Red,
Aspose.Imaging.Color.Green);
// Fill the active frame with a linear gradient brush.
Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(tiffImage.ActiveFrame);
gr.FillRectangle(brush, tiffImage.Bounds);
// Grayscale options
Aspose.Imaging.ImageOptions.TiffOptions createTiffFrameOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Aspose.Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);
createTiffFrameOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream());
createTiffFrameOptions.Photometric = Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.MinIsBlack;
createTiffFrameOptions.BitsPerSample = new ushort[] { 8 };
// Create a grayscale copy of the active frame.
// The pixel data is preserved but converted to the desired format.
Aspose.Imaging.FileFormats.Tiff.TiffFrame grayscaleFrame = Aspose.Imaging.FileFormats.Tiff.TiffFrame.CreateFrameFrom(tiffImage.ActiveFrame, createTiffFrameOptions);
// Add the newly created frame to the TIFF image.
tiffImage.AddFrame(grayscaleFrame);
tiffImage.Save();
}
Crop(Rectangle)
그림을 찢어 버린다.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
Rectangle
오른쪽 쪽 쪽
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
원본 파일 설정에 기초한 옵션.
ReleaseManagedResources()
관리된 자원을 풀어주십시오. 관리되지 않은 자원이 여기에서 풀어주지 않도록하십시오.이 자원은 이미 풀어주었을 수도 있기 때문에.
protected override void ReleaseManagedResources()
RemoveMetadata()
이 이미지 사례 메타 데이터를 제거하여 이 Aspose.Imaging.Xmp.IHasXMPData.xmpdata 및 VL16 .Exif.IhasExivDat.ExIFDate 값을 설정합니다. 0 0 0 0.
public override void RemoveMetadata()
Resize(인트, 인트, ResizeType)
이미지를 재현합니다.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
int
새로운 광도 입니다.
newHeight
int
새로운 높이 입니다.
resizeType
ResizeType
리세스 타입이죠.
Rotate(플로트, 볼, 색상)
센터 주위에 사진을 회전합니다.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
float
긍정적 값은 시계로 회전합니다.
resizeProportionally
bool
‘진실’으로 설정하면 이미지 크기가 회전 된 직경 (구석 지점) 프로젝션에 따라 변경되며, 다른 경우에는 차원을 만지지 않고 내부 이미지 콘텐츠만 회전됩니다.
backgroundColor
Color
배경의 색깔.
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
새로운 이미지 높이.