Class JpegImage

Class JpegImage

ชื่อพื้นที่: Aspose.Imaging.FileFormats.Jpeg การประกอบ: Aspose.Imaging.dll (25.4.0)

การจัดการภาพสกรู JPEGได้อย่างมีประสิทธิภาพด้วย API ของเราให้การสนับสนุนสําหรับโปรไฟล์สีต่างๆเช่น RGB และ CMYK บิตที่กําหนดเองต่อพิกเซลการแก้ปัญหาและการประมวลผลของ EXIF, JFIF และคอนเทนเนอร์ metadata XMPเพลิดเพลินไปกับหมุนอัตโนมัติขึ้นอยู่กับข้อมูลแนวตั้งและเลือกจากที่แตกต่างกันระดับการบีบอัดรวมทั้ง JPEG ฟรีเพื่อให้ได้คุณภาพภาพที่ดีที่สุดและไฟล์ขนาดสมดุลสําหรับโครงการของคุณ

[JsonObject(MemberSerialization.OptIn)]
public sealed class JpegImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasJpegExifData, IHasExifData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image RasterImage RasterCachedImage JpegImage

Implements

IDisposable , IObjectWithBounds , IRasterImageArgb32PixelLoader , IRasterImageRawDataLoader , IHasXmpData , IHasJpegExifData , IHasExifData , 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

เข้าถึงผู้ผลิตกล้องบันทึกในภาพ Jpeg

using (var image = (JpegImage)Image.Load("Sample.jpg"))
                                                                {
                                                                    foreach (var makerNote in image.ExifData.MakerNotes)
                                                                    {
                                                                        Console.WriteLine("Name = {0}, Value = {1}", makerNote.Name, makerNote.Value);
                                                                    }
                                                                }

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลด JpegImage จากไฟล์

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

                                                                 // Load a JPEG image from a file.
                                                                 using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(dir + "sample.jpg"))
                                                                 {
                                                                     // Do some image processing.
                                                                     // Save to another JPEG file.
                                                                     jpegImage.Save(dir + "sample.output.jpg");
                                                                 }

Constructors

JpegImage(รั้ว)

คลาส Aspose.Imaging.FileFormats.Jpeg.JpegImage เริ่มต้นอย่างหนักโดยเรียกร้องผู้ก่อสร้างที่มีเส้นทางที่ระบุพารามิเตอร์ ผู้ก่อสร้างนี้ช่วยให้ไม่มีรอยต่อการสร้างภาพ JPEG เพื่อให้แน่ใจว่าการรวมกันอย่างรวดเร็วในโครงการของคุณได้ง่าย

public JpegImage(string path)

Parameters

path string

เส้นทางในการโหลดภาพจากและเริ่มต้นข้อมูล pixel และ palette กับ

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลด JpegImage จากไฟล์

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

                                                                 // Load a JPEG image from a file.
                                                                 using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(dir + "sample.jpg"))
                                                                 {
                                                                     // Do some image processing.
                                                                     // Save to another JPEG file.
                                                                     jpegImage.Save(dir + "sample.output.jpg");
                                                                 }

JpegImage(Stream)

Initialize a JPEG image object with the Aspose.Imaging.FileFormats.Jpeg.JpegImage class using aพารามิเตอร์การไหล เครื่องก่อสร้างนี้ทําให้กระบวนการทํางานได้ง่ายขึ้นกับ JPEGภาพนําเสนอวิธีการที่เรียบง่ายเพื่อรวมพวกเขาในโครงการของคุณไม่พยายาม

public JpegImage(Stream stream)

Parameters

stream Stream

กระแสที่จะโหลดภาพจากและเริ่มต้นข้อมูลพิกเซลและแพลตกับ

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลด JpegImage จากการไหลของไฟล์

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

                                                                        // Load a JPEG image from a file stream.
                                                                        using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "sample.jpg"))
                                                                        {
                                                                            using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(stream))
                                                                            {
                                                                                // Do some image processing.
                                                                                // Save to another JPEG file.
                                                                                jpegImage.Save(dir + "sample.output.jpg");
                                                                            }
                                                                        }

JpegImage(RasterImage)

เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Imaging.FileFormats.Jpeg.JpegImage ด้วยภาพสกรูพารามิเตอร์ Constructor นี้ให้วิธีที่สะดวกในการสร้างภาพ JPEGโดยตรงจากภาพ raster, ปรับปรุงการไหลของงานสําหรับการทํางานกับภาพ JPEGในแอพลิเคชันของคุณ

public JpegImage(RasterImage rasterImage)

Parameters

rasterImage RasterImage

รูปภาพเพื่อเริ่มต้นข้อมูล pixel และ palette กับ.

Examples

ตัวอย่างนี้แสดงให้เห็นวิธีการโหลด JpegImage จาก RasterImage อื่น ๆ

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

                                                                              // Load a JPEG image from another raster image.
                                                                              // First, create a temporal PNG image that will be a foundation for building a JPEG image.
                                                                              // You can also load PNG image from a file or use an image of any other raster format.
                                                                              Aspose.Imaging.ImageOptions.PngOptions createOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                              createOptions.Source = new Aspose.Imaging.Sources.StreamSource(new System.IO.MemoryStream(), false);
                                                                              using (Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Create(createOptions, 100, 100))
                                                                              {
                                                                                  // Fill the entire PNG image in red.
                                                                                  Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(rasterImage);
                                                                                  Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
                                                                                  graphics.FillRectangle(brush, rasterImage.Bounds);

                                                                                  // Create a JPEG image based on the PNG image.
                                                                                  using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(rasterImage))
                                                                                  {
                                                                                      // Save to a JPEG file
                                                                                      jpegImage.Save(dir + "output.jpg");
                                                                                  }
                                                                              }

JpegImage(int, int)

สร้างตัวอย่างใหม่ของ Aspose.Imaging.FileFormats.Jpeg.JpegImage class ด้วยความกว้างที่ระบุและความสูงพารามิเตอร์ Constructor นี้ช่วยให้คุณสามารถสร้างภาพ JPEG กับขนาดที่กําหนดเองให้ความยืดหยุ่นในการจัดการขนาดภาพในแอพของคุณ

public JpegImage(int width, int height)

Parameters

width int

ความกว้างของภาพ

height int

ความสูงของภาพ

Examples

ตัวอย่างต่อไปนี้แสดงวิธีการสร้างภาพ JPEG ของขนาดที่ระบุ

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

                                                                                      // Create a JPEG image of 100x100 px.
                                                                                      using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(100, 100))
                                                                                      {
                                                                                          // Do some image processing.
                                                                                          // Save to a file.
                                                                                          jpegImage.Save(dir + "output.jpg");
                                                                                      }

ตัวอย่างต่อไปนี้โหลดภาพ BMP และบันทึกเป็น JPEG โดยใช้ตัวเลือกการบันทึกต่างๆ

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

                                                                                                   // Load a BMP image from a file.
                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                   {
                                                                                                       // Do some image processing.

                                                                                                       // Use additional options to specify the desired image parameters.
                                                                                                       Aspose.Imaging.ImageOptions.JpegOptions saveOptions = new Aspose.Imaging.ImageOptions.JpegOptions();

                                                                                                       // The number of bits per channel is 8.
                                                                                                       // When a palette is used, the color index is stored in the image data instead of the color itself.
                                                                                                       saveOptions.BitsPerChannel = 8;

                                                                                                       // Set the progressive type of compression.
                                                                                                       saveOptions.CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Progressive;

                                                                                                       // Set the image quality. It is a value between 1 and 100.
                                                                                                       saveOptions.Quality = 100;

                                                                                                       // Set the horizontal/vertical resolution to 96 dots per inch.
                                                                                                       saveOptions.ResolutionSettings = new Aspose.Imaging.ResolutionSetting(96.0, 96.0);
                                                                                                       saveOptions.ResolutionUnit = Aspose.Imaging.ResolutionUnit.Inch;

                                                                                                       // If the source image is colored, it will be converted to grayscaled.
                                                                                                       saveOptions.ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.Grayscale;

                                                                                                       // Use a palette to reduce the output size.
                                                                                                       saveOptions.Palette = Aspose.Imaging.ColorPaletteHelper.Create8BitGrayscale(false);

                                                                                                       image.Save(dir + "sample.palettized.jpg", saveOptions);
                                                                                                   }

JpegImage(JpegOptions, int, int)

เริ่มต้นวัตถุ Aspose.Imaging.FileFormats.Jpeg.JpegImage ใหม่ด้วยตัวเลือก JPEG ที่ให้ผู้สร้างนี้ช่วยให้คุณสามารถปรับการตั้งค่าต่างๆสําหรับภาพ JPEG เช่นระดับการบีบอัดคุณภาพและพารามิเตอร์เพิ่มเติมให้การควบคุมที่แม่นยําผ่านรูปแบบภาพที่เกิดขึ้น

public JpegImage(JpegOptions jpegOptions, int width, int height)

Parameters

jpegOptions JpegOptions

ตัวเลือก jpeg

width int

ความกว้างของภาพ

height int

ความสูงของภาพ

Examples

ตัวอย่างต่อไปนี้โหลดภาพ BMP และบันทึกเป็น JPEG โดยใช้ตัวเลือกการบันทึกต่างๆ

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

                                                                                                   // Load a BMP image from a file.
                                                                                                   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                   {
                                                                                                       // Do some image processing.

                                                                                                       // Use additional options to specify the desired image parameters.
                                                                                                       Aspose.Imaging.ImageOptions.JpegOptions saveOptions = new Aspose.Imaging.ImageOptions.JpegOptions();

                                                                                                       // The number of bits per channel is 8.
                                                                                                       // When a palette is used, the color index is stored in the image data instead of the color itself.
                                                                                                       saveOptions.BitsPerChannel = 8;

                                                                                                       // Set the progressive type of compression.
                                                                                                       saveOptions.CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Progressive;

                                                                                                       // Set the image quality. It is a value between 1 and 100.
                                                                                                       saveOptions.Quality = 100;

                                                                                                       // Set the horizontal/vertical resolution to 96 dots per inch.
                                                                                                       saveOptions.ResolutionSettings = new Aspose.Imaging.ResolutionSetting(96.0, 96.0);
                                                                                                       saveOptions.ResolutionUnit = Aspose.Imaging.ResolutionUnit.Inch;

                                                                                                       // If the source image is colored, it will be converted to grayscaled.
                                                                                                       saveOptions.ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.Grayscale;

                                                                                                       // Use a palette to reduce the output size.
                                                                                                       saveOptions.Palette = Aspose.Imaging.ColorPaletteHelper.Create8BitGrayscale(false);

                                                                                                       image.Save(dir + "sample.palettized.jpg", saveOptions);
                                                                                                   }

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการสร้างภาพ JPEG ของขนาดที่ระบุด้วยพารามิเตอร์ที่ระบุ

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

                                                                                                                    // Create a JPEG image of 100x100 px.
                                                                                                                    // Use additional options to specify the desired image parameters.
                                                                                                                    Aspose.Imaging.ImageOptions.JpegOptions createOptions = new Aspose.Imaging.ImageOptions.JpegOptions();

                                                                                                                    // The number of bits per channel is 8, 8, 8 for Y, Cr, Cb components accordingly.
                                                                                                                    createOptions.BitsPerChannel = 8;

                                                                                                                    // Set the progressive type of compression.
                                                                                                                    createOptions.CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Progressive;

                                                                                                                    // Set the image quality. It is a value between 1 and 100.
                                                                                                                    createOptions.Quality = 100;

                                                                                                                    // Set the horizontal/vertical resolution to 96 dots per inch.
                                                                                                                    createOptions.ResolutionSettings = new Aspose.Imaging.ResolutionSetting(96.0, 96.0);
                                                                                                                    createOptions.ResolutionUnit = Aspose.Imaging.ResolutionUnit.Inch;

                                                                                                                    // This is a standard option for JPEG images.
                                                                                                                    // Two chroma components (Cb and Cr) can be bandwidth-reduced, subsampled, compressed.
                                                                                                                    createOptions.ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.YCbCr;

                                                                                                                    using (Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = new Aspose.Imaging.FileFormats.Jpeg.JpegImage(createOptions, 100, 100))
                                                                                                                    {
                                                                                                                        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(jpegImage);

                                                                                                                        Aspose.Imaging.Brushes.LinearGradientBrush gradientBrush = new Aspose.Imaging.Brushes.LinearGradientBrush(
                                                                                                                            new Aspose.Imaging.Point(0, 0),
                                                                                                                            new Aspose.Imaging.Point(jpegImage.Width, jpegImage.Height),
                                                                                                                            Aspose.Imaging.Color.Yellow,
                                                                                                                            Aspose.Imaging.Color.Blue);

                                                                                                                        // Fill the image with a grayscale gradient
                                                                                                                        graphics.FillRectangle(gradientBrush, jpegImage.Bounds);

                                                                                                                        // Save to a file.
                                                                                                                        jpegImage.Save(dir + "output.explicitoptions.jpg");
                                                                                                                    }

Properties

BitsPerPixel

การกู้คืนความลึกของภาพได้อย่างง่ายดายด้วยคุณสมบัตินี้ความเข้าใจในความอุดมสมบูรณ์ของสีหรือการแสดงสีเทา ไม่ว่ามันเป็นการถ่ายภาพที่มีชีวิตชีวาหรือการอธิบาย monochrome คุณสมบัตินี้ให้ความสําคัญข้อมูลเกี่ยวกับความซับซ้อนของภาพ

public override int BitsPerPixel { get; }

คุณสมบัติมูลค่า

int

CmykColorProfile

โปรไฟล์สี CMYK ที่เกี่ยวข้องกับภาพ CMYK และ YCCK JPEG ให้ความแม่นยําการแปลงสีและความเชื่อถือ มันทํางานร่วมกับ RGBColorProfileรับประกันการแสดงผลสีที่แม่นยําทั่วอุปกรณ์และแอพต่างๆคู่นี้เป็นสิ่งสําคัญในการรักษาความสม่ําเสมอในการแสดงสีและการบรรลุคุณภาพภาพที่ดีที่สุด

public StreamSource CmykColorProfile { get; set; }

คุณสมบัติมูลค่า

StreamSource

Examples

ตัวอย่างต่อไปนี้โหลด PNG และบันทึกเป็น CMYK JPEG โดยใช้โปรไฟล์ ICC ที่กําหนดเอง จากนั้นโหลด CMYK JPEG และบันทึกเป็น PNG การแปลงสีจาก RGB ไปยัง CMYK และจาก CMYK ไปยัง RGB จะดําเนินการโดยใช้โปรไฟล์ ICC ที่กําหนดเอง

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

                                                                                                                                                                                                                                                // Load PNG and save it to CMYK JPEG
                                                                                                                                                                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage image = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Load(dir + "sample.png"))
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
                                                                                                                                                                                                                                                    using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                        Aspose.Imaging.ImageOptions.JpegOptions saveOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
                                                                                                                                                                                                                                                        saveOptions.ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.Cmyk;

                                                                                                                                                                                                                                                        // Use custom ICC profiles
                                                                                                                                                                                                                                                        saveOptions.RgbColorProfile = new Aspose.Imaging.Sources.StreamSource(rgbProfileStream);
                                                                                                                                                                                                                                                        saveOptions.CmykColorProfile = new Aspose.Imaging.Sources.StreamSource(cmykProfileStream);

                                                                                                                                                                                                                                                        image.Save(dir + "output.cmyk.jpg", saveOptions);
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                // Load CMYK JPEG and save it to PNG
                                                                                                                                                                                                                                                using (Aspose.Imaging.FileFormats.Jpeg.JpegImage image = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)Image.Load(dir + "output.cmyk.jpg"))
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
                                                                                                                                                                                                                                                    using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                        // Use custom ICC profiles
                                                                                                                                                                                                                                                        image.RgbColorProfile = new Aspose.Imaging.Sources.StreamSource(rgbProfileStream);
                                                                                                                                                                                                                                                        image.CmykColorProfile = new Aspose.Imaging.Sources.StreamSource(cmykProfileStream);

                                                                                                                                                                                                                                                        Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                                                                                                                        image.Save(dir + "output.rgb.png", saveOptions);
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                }

Comment

การจัดการความคิดเห็นไฟล์ JPEG ด้วยคุณสมบัตินี้ช่วยให้คุณสามารถเพิ่มหรือรับคําอธิบายที่เชื่อมโยงกับภาพ ไม่ว่ามันเป็นแท็กภาพกับmetadata หรืออธิบายเนื้อหาเพิ่มเติมคุณสมบัตินี้ให้ความยืดหยุ่นในการการจัดระเบียบและหมวดหมู่ไฟล์ JPEG ของคุณ

public string Comment { get; set; }

คุณสมบัติมูลค่า

string

DestinationCmykColorProfile

โปรไฟล์สี CMYK เป็นสิ่งสําคัญสําหรับการแปลงสีที่แม่นยําของ CMYK และ YCCKภาพ JPEG ในระหว่างกระบวนการประหยัด มันทํางานร่วมกับ RGBColorProfileเพื่อให้แน่ใจว่าการแสดงผลสีที่ถูกต้องรักษาความสม่ําเสมอและคุณภาพระหว่างอุปกรณ์และซอฟต์แวร์ที่แตกต่างกัน การ synchronization นี้เป็นสิ่งสําคัญในการบรรลุการแสดงสีที่แม่นยําและน่าเชื่อถือในภาพที่บันทึกไว้สุดท้าย

public StreamSource DestinationCmykColorProfile { get; set; }

คุณสมบัติมูลค่า

StreamSource

DestinationRgbColorProfile

RGBColorProfile เป็นสิ่งสําคัญสําหรับการแปลงสีที่แม่นยําของ CMYK และ YCCKภาพ JPEG ในระหว่างกระบวนการบันทึก เมื่อมีการจับคู่กับ CMYKColorProfileให้แน่ใจว่าสีจะถูกนําเสนออย่างถูกต้องและรักษาความสม่ําเสมอระหว่างอุปกรณ์และแอพพลิเคชันที่แตกต่างกัน การรวมกันนี้เป็นสิ่งสําคัญในการรักษาการแสดงสีที่กําหนดและบรรลุภาพที่มีคุณภาพสูง

public StreamSource DestinationRgbColorProfile { get; set; }

คุณสมบัติมูลค่า

StreamSource

ExifData

การจัดการข้อมูล EXIF ด้วยคุณสมบัตินี้ช่วยให้คุณสามารถเพิ่มหรือรับข้อมูล metadataเชื่อมต่อกับภาพ ไม่ว่ามันจะดึงข้อมูลเกี่ยวกับกล้องการตั้งค่าหรือการเปลี่ยนแปลงข้อมูลโลหะที่มีอยู่คุณสมบัตินี้ให้ความยืดหยุ่นในการการจัดการคอนเทนเนอร์ข้อมูล EXIF

public JpegExifData ExifData { get; set; }

คุณสมบัติมูลค่า

JpegExifData

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการสกัดแท็ก EXIF จากภาพ JPEG

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

                                                                                  using (Aspose.Imaging.FileFormats.Jpeg.JpegImage image = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)Image.Load(dir + "original.jpg"))
                                                                                  {
                                                                                      Aspose.Imaging.Exif.ExifData exifData = image.ExifData;

                                                                                      System.Console.WriteLine("The general EXIF data");
                                                                                      System.Console.WriteLine("------------------------------------------");
                                                                                      if (exifData != null)
                                                                                      {
                                                                                          System.Console.WriteLine("The EXIF version: {0}", exifData.ExifVersion);
                                                                                          System.Console.WriteLine("The camera serial number: {0}", exifData.BodySerialNumber);
                                                                                          System.Console.WriteLine("The color space: {0}", exifData.ColorSpace);
                                                                                          System.Console.WriteLine("The brightness: {0}", exifData.BrightnessValue);
                                                                                          System.Console.WriteLine("The contrast: {0}", exifData.Contrast);
                                                                                          System.Console.WriteLine("The gamma: {0}", exifData.Gamma);
                                                                                          System.Console.WriteLine("The sharpness: {0}", exifData.Sharpness);
                                                                                          System.Console.WriteLine("The aperture: {0}", exifData.ApertureValue);
                                                                                          System.Console.WriteLine("The exposure mode: {0}", exifData.ExposureMode);
                                                                                          System.Console.WriteLine("The exposure bias: {0}", exifData.ExposureBiasValue);
                                                                                          System.Console.WriteLine("The exposure time: {0}", exifData.ExposureTime);
                                                                                          System.Console.WriteLine("The focal length: {0}", exifData.FocalLength);
                                                                                          System.Console.WriteLine("The focal plane resolution unit: {0}", exifData.FocalPlaneResolutionUnit);
                                                                                          System.Console.WriteLine("The lens model: {0}", exifData.LensModel);
                                                                                          System.Console.WriteLine("The shutter speed: {0}", exifData.ShutterSpeedValue);
                                                                                      }

                                                                                      System.Console.WriteLine("The JPEG EXIF data");
                                                                                      System.Console.WriteLine("------------------------------------------");
                                                                                      Aspose.Imaging.Exif.JpegExifData jpegExifData = image.ExifData as Aspose.Imaging.Exif.JpegExifData;
                                                                                      if (jpegExifData != null)
                                                                                      {
                                                                                          System.Console.WriteLine("The camera manufacturer: {0}", jpegExifData.Make);
                                                                                          System.Console.WriteLine("The camera model: {0}", jpegExifData.Model);
                                                                                          System.Console.WriteLine("The photometric interpretation: {0}", jpegExifData.PhotometricInterpretation);
                                                                                          System.Console.WriteLine("The artist: {0}", jpegExifData.Artist);
                                                                                          System.Console.WriteLine("The copyright: {0}", jpegExifData.Copyright);
                                                                                          System.Console.WriteLine("The image description: {0}", jpegExifData.ImageDescription);
                                                                                          System.Console.WriteLine("The orientation: {0}", jpegExifData.Orientation);
                                                                                          System.Console.WriteLine("The software: {0}", jpegExifData.Software);
                                                                                      }
                                                                                  }

                                                                                  //The output looks like this:
                                                                                  //The general EXIF data
                                                                                  //------------------------------------------
                                                                                  //The EXIF version: System.Byte[]
                                                                                  //The camera serial number: 7100536
                                                                                  //The color space: SRgb
                                                                                  //The brightness:
                                                                                  //The contrast: Normal
                                                                                  //The gamma:
                                                                                  //The sharpness: 0
                                                                                  //The aperture: 4.64(4643856 / 1000000)
                                                                                  //The exposure mode: Manual
                                                                                  //The exposure bias: 0.67(4 / 6)
                                                                                  //The exposure time: 0.01(1 / 160)
                                                                                  //The focal length: 145.00(1450 / 10)
                                                                                  //The focal plane resolution unit: Cm
                                                                                  //The lens model: 70.0 - 200.0 mm f/ 4.0
                                                                                  //The shutter speed: 7.32(7321928 / 1000000)
                                                                                  //The JPEG EXIF data
                                                                                  //------------------------------------------
                                                                                  //The camera manufacturer: NIKON CORPORATION
                                                                                  //The camera model: NIKON D5
                                                                                  //The photometric interpretation: 0
                                                                                  //The artist: 
                                                                                  //The copyright: 
                                                                                  //The image description:
                                                                                  //The orientation: TopLeft
                                                                                  //The software: Adobe Photoshop Camera Raw 9.9(Macintosh)

FileFormat

ปรับปรุงรูปแบบของภาพได้อย่างง่ายดายด้วยคุณสมบัตินี้ความเข้าใจที่มีมูลค่าในรูปแบบไฟล์ช่วยในการรวมกันและการตรวจสอบความเข้ากันได้ผ่านแพลตฟอร์มและแอพพลิเคชันต่างๆ

public override FileFormat FileFormat { get; }

คุณสมบัติมูลค่า

FileFormat

Height

รับความสูงของภาพได้อย่างง่ายดายด้วยคุณสมบัตินี้ มันให้ความเร็วการเข้าถึงขนาดแนวตั้งของภาพช่วยให้คุณสามารถเข้าถึงได้อย่างมีประสิทธิภาพการกําหนดขนาดและความสัมพันธ์ด้านโดยไม่ต้องมีการคํานวณที่ซับซ้อนหรือวิธีการเพิ่มเติม

public override int Height { get; }

คุณสมบัติมูลค่า

int

HorizontalResolution

คุณสมบัตินี้ช่วยให้คุณสามารถเข้าถึงการแก้ปัญหาแนวนอนของAspose.Imaging.RasterImage, วัดในพิกเซลต่อ นิ้ว โดยการตั้งค่าหรือการรับหมายเลขนี้คุณสามารถควบคุมความละเอียดของภาพได้อย่างแม่นยําเพื่อให้แน่ใจว่าตอบสนองความต้องการเฉพาะของคุณสําหรับคุณภาพและความชัดเจน

public override double HorizontalResolution { get; set; }

คุณสมบัติมูลค่า

double

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งค่าความละเอียดแนวนอน/แนวตั้งของภาพ JPEG

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

                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                 {
                                                                                                     Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)image;

                                                                                                     // Get horizontal and vertical resolution of the BmpImage
                                                                                                     double horizontalResolution = jpegImage.HorizontalResolution;
                                                                                                     double verticalResolution = jpegImage.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");
                                                                                                         jpegImage.SetResolution(96.0, 96.0);

                                                                                                         System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpegImage.HorizontalResolution);
                                                                                                         System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpegImage.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

หมายเหตุตาม default หมายเลขนี้เป็น 96 เนื่องจากแพลตฟอร์มที่แตกต่างกันไม่สามารถคืนความละเอียดหน้าจอได้ คุณสามารถพิจารณาการใช้วิธีการ SetResolution เพื่อปรับปรุงค่าความละเอียดทั้งสองในโทรเดียว

IgnoreEmbeddedColorProfile

กลับหรือปรับเปลี่ยนกระดาษแสดงให้เห็นว่าโปรไฟล์สีที่รวมเป็นโดยการตั้งค่าป้ายนี้ผู้ใช้สามารถระบุว่าสีที่กําหนดเองโปรไฟล์ควรใช้แทนที่แบบบูรณาการ ตัวเลือกนี้ให้แน่ใจว่าขนาดใหญ่การควบคุมการจัดการสีช่วยให้การปรับความสม่ําเสมอและความเข้ากันได้ผ่านแพลตฟอร์มและแอพพลิเคชันต่างๆ

public bool IgnoreEmbeddedColorProfile { get; set; }

คุณสมบัติมูลค่า

bool

Jfif

คุณสมบัตินี้ช่วยให้คุณสามารถเข้าถึงหรือแก้ไข JFIF (JPEG File Interchange)รูปแบบ) ข้อมูลที่เกี่ยวข้องกับภาพ JPEG JFIF เป็นรูปแบบมาตรฐานสําหรับการแลกเปลี่ยนภาพที่บีบอัด JPEGระหว่างคอมพิวเตอร์และอุปกรณ์อื่น ๆ โดยได้รับหรือตั้งค่าคุณสมบัตินี้คุณสามารถโต้ตอบกับข้อมูล JFIF ซึ่งอาจรวมถึงข้อมูลเช่นความละเอียดของภาพอัตราส่วนและขนาดเล็ก

public JFIFData Jfif { get; set; }

คุณสมบัติมูลค่า

JFIFData

JpegOptions

ได้รับการเข้าถึงตัวเลือก JPEG ที่ใช้ในระหว่างการสร้างหรือโหลดตัวอย่าง Aspose.Imaging.FileFormats.Jpeg.JpegImage ด้วยความสะดวก คุณสมบัตินี้มีรายละเอียดที่มีค่าเกี่ยวกับการตั้งค่าที่เฉพาะเจาะจงที่ใช้ช่วยให้ผู้ใช้เข้าใจและทําซ้ําการประมวลผลภาพกระแสการทํางานได้อย่างมีประสิทธิภาพ ไม่ว่ามันเป็นระดับการบีบอัดคุณภาพการตั้งค่าหรือพารามิเตอร์อื่น ๆ คุณสมบัตินี้ให้ความเข้าใจสําคัญสําหรับการจัดการภาพแบบไร้รอยต่อ

public JpegOptions JpegOptions { get; }

คุณสมบัติมูลค่า

JpegOptions

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการสกัดข้อมูลหัวจากภาพ JPEG

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

                                                                                               using (Aspose.Imaging.FileFormats.Jpeg.JpegImage image = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)Image.Load(dir + "original.jpg"))
                                                                                               {
                                                                                                   Aspose.Imaging.ImageOptions.JpegOptions jpegOptions = image.JpegOptions;

                                                                                                   System.Console.WriteLine("The number of bits per channel: {0}", jpegOptions.BitsPerChannel);
                                                                                                   System.Console.WriteLine("The max allowed size for all internal buffers: {0}", jpegOptions.BufferSizeHint);
                                                                                                   System.Console.WriteLine("The color type: {0}", jpegOptions.ColorType);
                                                                                                   System.Console.WriteLine("The compression type: {0}", jpegOptions.CompressionType);
                                                                                                   System.Console.WriteLine("The image quality: {0}", jpegOptions.Quality);

                                                                                                   if (jpegOptions.ResolutionSettings != null)
                                                                                                   {
                                                                                                       System.Console.WriteLine("The horizontal resolution: {0}", jpegOptions.ResolutionSettings.HorizontalResolution);
                                                                                                       System.Console.WriteLine("The vertical resolution: {0}", jpegOptions.ResolutionSettings.VerticalResolution);
                                                                                                   }

                                                                                                   for (int i = 0; i < jpegOptions.HorizontalSampling.Length; i++)
                                                                                                   {
                                                                                                       System.Console.WriteLine("The sampling for component {0}: {1}x{2}", i, jpegOptions.HorizontalSampling[i], jpegOptions.VerticalSampling[i]);
                                                                                                   }
                                                                                               }

                                                                                               //The output looks like this:
                                                                                               //The number of bits per channel: 8
                                                                                               //The max allowed size for all internal buffers: 0
                                                                                               //The color type: YCbCr
                                                                                               //The compression type: Baseline
                                                                                               //The image quality: 75
                                                                                               //The sampling for component 0: 1x1
                                                                                               //The sampling for component 1: 1x1
                                                                                               //The sampling for component 2: 1x1

RawDataFormat

คุณสมบัตินี้จะได้รับรูปแบบข้อมูลวัตถุดิบของภาพซึ่งแสดงให้เห็นว่าข้อมูลภาพถูกโครงสร้างและเข้ารหัส การเข้าใจรูปแบบข้อมูลดิบคือมันเป็นสิ่งสําคัญสําหรับการประมวลผลหรือการจัดการข้อมูลภาพได้อย่างมีประสิทธิภาพความเข้าใจเกี่ยวกับการแสดงผลพื้นฐานของภาพเช่นถ้ามันเป็นการบีบอัดรหัสในพื้นที่สีที่เฉพาะเจาะจงหรือเก็บไว้ในไฟล์ที่เฉพาะเจาะจงการเข้าถึงคุณสมบัตินี้ช่วยให้คุณได้รับข้อมูลที่มีค่าเกี่ยวกับโครงสร้างข้อมูลของภาพซึ่งช่วยให้คุณสามารถดําเนินการต่างๆหรือการปรับปรุงเหมาะกับรูปแบบที่กําหนดเอง

public override PixelDataFormat RawDataFormat { get; }

คุณสมบัติมูลค่า

PixelDataFormat

RgbColorProfile

โปรไฟล์สี RGB สําหรับภาพ CMYK และ YCCK JPEG ให้แน่ใจว่าสีที่ถูกต้องการแปลงและการแสดงผล มันต้องมีการจับคู่กับ CMYKColorProfile เพื่อรักษาความสม่ําเสมอและความซื่อสัตย์ในการแสดงสี คู่นี้เป็นสิ่งสําคัญสําหรับการประยุกต์ใช้ที่ต้องการการจัดการสีที่แม่นยําและการสร้างภาพเพื่อให้แน่ใจว่าข้อมูล RGB จะได้รับการตีความและแสดงอย่างถูกต้อง

public StreamSource RgbColorProfile { get; set; }

คุณสมบัติมูลค่า

StreamSource

Examples

ตัวอย่างต่อไปนี้โหลด PNG และบันทึกเป็น CMYK JPEG โดยใช้โปรไฟล์ ICC ที่กําหนดเอง จากนั้นโหลด CMYK JPEG และบันทึกเป็น PNG การแปลงสีจาก RGB ไปยัง CMYK และจาก CMYK ไปยัง RGB จะดําเนินการโดยใช้โปรไฟล์ ICC ที่กําหนดเอง

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

                                                                                                                                                                                                                                                // Load PNG and save it to CMYK JPEG
                                                                                                                                                                                                                                                using (Aspose.Imaging.FileFormats.Png.PngImage image = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Load(dir + "sample.png"))
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
                                                                                                                                                                                                                                                    using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                        Aspose.Imaging.ImageOptions.JpegOptions saveOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
                                                                                                                                                                                                                                                        saveOptions.ColorType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionColorMode.Cmyk;

                                                                                                                                                                                                                                                        // Use custom ICC profiles
                                                                                                                                                                                                                                                        saveOptions.RgbColorProfile = new Aspose.Imaging.Sources.StreamSource(rgbProfileStream);
                                                                                                                                                                                                                                                        saveOptions.CmykColorProfile = new Aspose.Imaging.Sources.StreamSource(cmykProfileStream);

                                                                                                                                                                                                                                                        image.Save(dir + "output.cmyk.jpg", saveOptions);
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                }

                                                                                                                                                                                                                                                // Load CMYK JPEG and save it to PNG
                                                                                                                                                                                                                                                using (Aspose.Imaging.FileFormats.Jpeg.JpegImage image = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)Image.Load(dir + "output.cmyk.jpg"))
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    using (System.IO.Stream rgbProfileStream = System.IO.File.OpenRead(dir + "eciRGB_v2.icc"))
                                                                                                                                                                                                                                                    using (System.IO.Stream cmykProfileStream = System.IO.File.OpenRead(dir + "ISOcoated_v2_FullGamut4.icc"))
                                                                                                                                                                                                                                                    {
                                                                                                                                                                                                                                                        // Use custom ICC profiles
                                                                                                                                                                                                                                                        image.RgbColorProfile = new Aspose.Imaging.Sources.StreamSource(rgbProfileStream);
                                                                                                                                                                                                                                                        image.CmykColorProfile = new Aspose.Imaging.Sources.StreamSource(cmykProfileStream);

                                                                                                                                                                                                                                                        Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                                                                                                                                                        image.Save(dir + "output.rgb.png", saveOptions);
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                                }

VerticalResolution

คุณสมบัตินี้จัดการความละเอียดแนวตั้งที่แสดงใน pixels per inch สําหรับที่เกี่ยวข้อง Aspose.Imaging.RasterImage การปรับความละเอียดนี้ส่งผลกระทบต่อขนาดและคุณภาพของภาพเมื่อพิมพ์หรือแสดงในขนาดทางกายภาพที่กําหนดโดยการตั้งค่าคุณสมบัตินี้คุณจะควบคุมความหนาแน่นของ pixels ของภาพถูกบรรจุvertically, ผลกระทบต่อความชัดเจนและความชัดเจนโดยรวม

public override double VerticalResolution { get; set; }

คุณสมบัติมูลค่า

double

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งค่าความละเอียดแนวนอน/แนวตั้งของภาพ JPEG

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

                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                 {
                                                                                                     Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)image;

                                                                                                     // Get horizontal and vertical resolution of the BmpImage
                                                                                                     double horizontalResolution = jpegImage.HorizontalResolution;
                                                                                                     double verticalResolution = jpegImage.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");
                                                                                                         jpegImage.SetResolution(96.0, 96.0);

                                                                                                         System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpegImage.HorizontalResolution);
                                                                                                         System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpegImage.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

หมายเหตุตาม default หมายเลขนี้เป็น 72 เนื่องจากแพลตฟอร์มที่แตกต่างกันไม่สามารถคืนความละเอียดหน้าจอได้ คุณสามารถพิจารณาการใช้วิธีการ SetResolution เพื่อปรับปรุงค่าความละเอียดทั้งสองในโทรเดียว

Width

คุณสมบัตินี้ได้รับความกว้างของภาพแสดงในพิกเซล มันให้ข้อมูลสําคัญเกี่ยวกับขนาดของภาพซึ่งช่วยให้การแสดงผลที่แม่นยําการจัดการหรือแสดงข้อมูลภาพ

public override int Width { get; }

คุณสมบัติมูลค่า

int

XmpData

รับหรือตั้งค่าข้อมูลโลหะ XMP ซึ่งช่วยให้การรวมข้อมูลข้อมูลอธิบายเข้าไปในไฟล์ภาพ ไม่ว่าคุณจะสกัด XMP ที่มีอยู่metadata หรืออัปเดตมันด้วยข้อมูลใหม่คุณสมบัตินี้ง่ายต่อการการจัดการข้อมูลโลหะขยายเพื่อให้แน่ใจว่ามีการเข้ากันได้กับแอพพลิเคชันต่างๆและกระแสการทํางาน

public override XmpPacketWrapper XmpData { get; set; }

คุณสมบัติมูลค่า

XmpPacketWrapper

Methods

AutoRotate()

การหมุนภาพโดยอัตโนมัติขึ้นอยู่กับข้อมูลแนวตั้งที่สกัดจาก Exifmetadata วิธีนี้ให้แน่ใจว่าภาพจะแสดงในทิศทางที่ถูกต้องการปรับปรุงประสบการณ์ของผู้ใช้และกําจัดความต้องการในการปรับแต่งด้วยตนเอง โดยการวิเคราะห์ข้อมูล Exif รูปภาพจะหมุนตามที่ให้ข้อมูลไร้สายประสบการณ์การดูผ่านแพลตฟอร์มและอุปกรณ์ต่างๆ การหมุนอัตโนมัตินี้กระบวนการทําให้การจัดการภาพง่ายขึ้นและปรับปรุงการใช้งานโดยรวมโดยเฉพาะอย่างยิ่งเมื่อการจัดการกับชุดขนาดใหญ่ของภาพที่มีแนวทางที่แตกต่างกัน

public void AutoRotate()

Exceptions

ArgumentOutOfRangeException

หมายเลข ‘Orientation’ ของ ‘JpegExifData’ เป็นภายใต้ช่วงที่อนุญาต [1…8], ดังนั้นการหมุนอัตโนมัติไม่สามารถใช้ได้

GetModifyDate(บอล)

กลับคืนวันที่และเวลาเมื่อภาพทรัพยากรได้รับล่าสุดการเปลี่ยนแปลง วิธีนี้ให้ข้อมูลโลหะที่มีค่าซึ่งช่วยให้ผู้ใช้สามารถติดตามและการจัดการอัปเดตไปยังไฟล์ภาพได้อย่างมีประสิทธิภาพ โดยการเข้าถึงข้อมูลนี้ผู้ใช้สามารถรับประกันความสมบูรณ์และค่าใช้จ่ายของสินทรัพย์ภาพของพวกเขาโดยช่วยให้ข้อมูลการตัดสินใจเกี่ยวกับการใช้งานและการบํารุงรักษาของภาพ

public override DateTime GetModifyDate(bool useDefault)

Parameters

useDefault bool

ถ้าตั้งค่าเป็น “จริง” ใช้ข้อมูลจาก FileInfo เป็นค่าเริ่มต้น

Returns

DateTime

วันที่และเวลาภาพทรัพยากรได้รับการแก้ไขครั้งสุดท้าย

ReleaseManagedResources()

เปิดตัวทรัพยากรที่จัดการ ตรวจสอบให้แน่ใจว่าไม่มีทรัพยากรที่ไม่ได้จัดการจะเปิดตัวที่นี่เนื่องจากอาจมีการเปิดตัวแล้ว

protected override void ReleaseManagedResources()

RemoveMetadata()

ลบตัวอย่างภาพนี้ metadata โดยการตั้งค่านี้ Aspose.Imaging.Xmp.IHasXMPData.xmpdata และ _ www.exif.ihas ExifDate. 0 0 0.

public override void RemoveMetadata()

SaveData(Stream)

เก็บข้อมูล

protected override void SaveData(Stream stream)

Parameters

stream Stream

กระแสเพื่อบันทึกข้อมูล

SetResolution(คู่, คู่)

กําหนดความละเอียดสําหรับ Aspose.Imaging.RasterImage ที่ระบุให้แน่ใจว่าความสามารถในการสแกนและพิมพ์ที่แม่นยํา วิธีนี้ช่วยให้ผู้ใช้สามารถปรับตัวได้ความละเอียดของภาพเพื่อตอบสนองความต้องการที่เฉพาะเจาะจงของพวกเขาทั้งสําหรับแบบดิจิตอลการแสดงผลหรือการสะสมทางกายภาพ โดยการตั้งค่าความละเอียดผู้ใช้สามารถปรับปรุงคุณภาพภาพและให้แน่ใจว่ามีการเข้ากันได้กับอุปกรณ์การส่งออกและสื่อต่างๆการปรับปรุงประสบการณ์ภาพรวมและการใช้งานของภาพ

public override void SetResolution(double dpiX, double dpiY)

Parameters

dpiX double

ความละเอียดแนวนอนในจุดต่อ นิ้วของ Aspose.Imaging.RasterImage

dpiY double

ความละเอียดแนวตั้งในจุดต่อ นิ้วของ Aspose.Imaging.RasterImage

Examples

ตัวอย่างต่อไปนี้แสดงให้เห็นวิธีการตั้งค่าความละเอียดแนวนอน/แนวตั้งของภาพ JPEG

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

                                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.jpg"))
                                                                                                 {
                                                                                                     Aspose.Imaging.FileFormats.Jpeg.JpegImage jpegImage = (Aspose.Imaging.FileFormats.Jpeg.JpegImage)image;

                                                                                                     // Get horizontal and vertical resolution of the BmpImage
                                                                                                     double horizontalResolution = jpegImage.HorizontalResolution;
                                                                                                     double verticalResolution = jpegImage.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");
                                                                                                         jpegImage.SetResolution(96.0, 96.0);

                                                                                                         System.Console.WriteLine("The horizontal resolution, in pixels per inch: {0}", jpegImage.HorizontalResolution);
                                                                                                         System.Console.WriteLine("The vertical resolution, in pixels per inch: {0}", jpegImage.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
                                                                                                 }

UpdateDimensions(int, int)

ปรับปรุงขนาดภาพ

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

ความกว้างของภาพใหม่

newHeight int

ความสูงของภาพใหม่

UpdateMetadata()

การอัปเดตของภาพ metadata

protected override void UpdateMetadata()
 แบบไทย