Class JpegImage
Nombre del espacio: Aspose.Imaging.FileFormats.Jpeg Asamblea: Aspose.Imaging.dll (25.4.0)
Manipular de manera eficiente las imágenes de raster JPEG con nuestra API, ofreciendo soportepara diferentes perfiles de color como RGB y CMYK, bits personalizables por pixelResolución y procesamiento de contenedores de metadatos EXIF, JFIF y XMP.Disfruta de la rotación automatizada basada en los datos de orientación y escoge entre diferentesniveles de compresión, incluyendo JPEG sin pérdida, para lograr la calidad óptima de la imageny el balance de tamaño para sus proyectos.
[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 ,y, IObjectWithBounds ,y, IRasterImageArgb32PixelLoader ,y, IRasterImageRawDataLoader ,y, IHasXmpData ,y, IHasJpegExifData ,y, IHasExifData ,y, IHasMetadata
Miembros heredados
RasterCachedImage.CacheData() ,y, RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte) ,y, RasterCachedImage.Resize(int, int, ResizeType) ,y, RasterCachedImage.Resize(int, int, ImageResizeSettings) ,y, RasterCachedImage.RotateFlip(RotateFlipType) ,y, RasterCachedImage.Rotate(float, bool, Color) ,y, RasterCachedImage.Crop(Rectangle) ,y, RasterCachedImage.Dither(DitheringMethod, int, IColorPalette) ,y, RasterCachedImage.Grayscale() ,y, RasterCachedImage.NormalizeHistogram() ,y, RasterCachedImage.BinarizeFixed(byte) ,y, RasterCachedImage.BinarizeOtsu() ,y, RasterCachedImage.BinarizeBradley(double, int) ,y, RasterCachedImage.BinarizeBradley(double) ,y, RasterCachedImage.AdjustBrightness(int) ,y, RasterCachedImage.AdjustContrast(float) ,y, RasterCachedImage.AdjustGamma(float, float, float) ,y, RasterCachedImage.AdjustGamma(float) ,y, RasterCachedImage.IsCached ,y, RasterImage.RemoveMetadata() ,y, RasterImage.Save(Stream, ImageOptionsBase, Rectangle) ,y, RasterImage.GetModifyDate(bool) ,y, RasterImage.Dither(DitheringMethod, int) ,y, RasterImage.Dither(DitheringMethod, int, IColorPalette) ,y, RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader) ,y, RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings) ,y, RasterImage.GetDefaultArgb32Pixels(Rectangle) ,y, RasterImage.GetDefaultRawData(Rectangle, RawDataSettings) ,y, RasterImage.GetArgb32Pixel(int, int) ,y, RasterImage.GetPixel(int, int) ,y, RasterImage.SetArgb32Pixel(int, int, int) ,y, RasterImage.SetPixel(int, int, Color) ,y, RasterImage.ReadScanLine(int) ,y, RasterImage.ReadArgb32ScanLine(int) ,y, RasterImage.WriteScanLine(int, Color[]) ,y, RasterImage.WriteArgb32ScanLine(int, int[]) ,y, RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader) ,y, RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader) ,y, RasterImage.LoadArgb32Pixels(Rectangle) ,y, RasterImage.LoadArgb64Pixels(Rectangle) ,y, RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader) ,y, RasterImage.LoadPixels(Rectangle) ,y, RasterImage.LoadCmykPixels(Rectangle) ,y, RasterImage.LoadCmyk32Pixels(Rectangle) ,y, RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader) ,y, RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader) ,y, RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings) ,y, RasterImage.SaveArgb32Pixels(Rectangle, int[]) ,y, RasterImage.SavePixels(Rectangle, Color[]) ,y, RasterImage.SaveCmykPixels(Rectangle, CmykColor[]) ,y, RasterImage.SaveCmyk32Pixels(Rectangle, int[]) ,y, RasterImage.SetResolution(double, double) ,y, RasterImage.SetPalette(IColorPalette, bool) ,y, RasterImage.Resize(int, int, ImageResizeSettings) ,y, RasterImage.Rotate(float, bool, Color) ,y, RasterImage.Rotate(float) ,y, RasterImage.BinarizeFixed(byte) ,y, RasterImage.BinarizeOtsu() ,y, RasterImage.BinarizeBradley(double) ,y, RasterImage.BinarizeBradley(double, int) ,y, RasterImage.Blend(Point, RasterImage, Rectangle, byte) ,y, RasterImage.Blend(Point, RasterImage, byte) ,y, RasterImage.Grayscale() ,y, RasterImage.NormalizeHistogram() ,y, RasterImage.AdjustBrightness(int) ,y, RasterImage.AdjustContrast(float) ,y, RasterImage.AdjustGamma(float, float, float) ,y, RasterImage.AdjustGamma(float) ,y, RasterImage.GetSkewAngle() ,y, RasterImage.NormalizeAngle() ,y, RasterImage.NormalizeAngle(bool, Color) ,y, RasterImage.Filter(Rectangle, FilterOptionsBase) ,y, RasterImage.ReplaceColor(Color, byte, Color) ,y, RasterImage.ReplaceColor(int, byte, int) ,y, RasterImage.ReplaceNonTransparentColors(Color) ,y, RasterImage.ReplaceNonTransparentColors(int) ,y, RasterImage.ToBitmap() ,y, RasterImage.PremultiplyComponents ,y, RasterImage.UseRawData ,y, RasterImage.UpdateXmpData ,y, RasterImage.XmpData ,y, RasterImage.RawIndexedColorConverter ,y, RasterImage.RawCustomColorConverter ,y, RasterImage.RawFallbackIndex ,y, RasterImage.RawDataSettings ,y, RasterImage.UsePalette ,y, RasterImage.RawDataFormat ,y, RasterImage.RawLineSize ,y, RasterImage.IsRawDataAvailable ,y, RasterImage.HorizontalResolution ,y, RasterImage.VerticalResolution ,y, RasterImage.HasTransparentColor ,y, RasterImage.HasAlpha ,y, RasterImage.TransparentColor ,y, RasterImage.ImageOpacity ,y, Image.CanLoad(string) ,y, Image.CanLoad(string, LoadOptions) ,y, Image.CanLoad(Stream) ,y, Image.CanLoad(Stream, LoadOptions) ,y, Image.Create(ImageOptionsBase, int, int) ,y, Image.Create(Image[]) ,y, Image.Create(MultipageCreateOptions) ,y, Image.Create(string[], bool) ,y, Image.Create(string[]) ,y, Image.Create(Image[], bool) ,y, Image.GetFileFormat(string) ,y, Image.GetFileFormat(Stream) ,y, Image.GetFittingRectangle(Rectangle, int, int) ,y, Image.GetFittingRectangle(Rectangle, int[], int, int) ,y, Image.Load(string, LoadOptions) ,y, Image.Load(string) ,y, Image.Load(Stream, LoadOptions) ,y, Image.Load(Stream) ,y, Image.GetProportionalWidth(int, int, int) ,y, Image.GetProportionalHeight(int, int, int) ,y, Image.RemoveMetadata() ,y, Image.CanSave(ImageOptionsBase) ,y, Image.Resize(int, int) ,y, Image.Resize(int, int, ResizeType) ,y, Image.Resize(int, int, ImageResizeSettings) ,y, Image.GetDefaultOptions(object[]) ,y, Image.GetOriginalOptions() ,y, Image.ResizeWidthProportionally(int) ,y, Image.ResizeHeightProportionally(int) ,y, Image.ResizeWidthProportionally(int, ResizeType) ,y, Image.ResizeHeightProportionally(int, ResizeType) ,y, Image.ResizeWidthProportionally(int, ImageResizeSettings) ,y, Image.ResizeHeightProportionally(int, ImageResizeSettings) ,y, Image.RotateFlip(RotateFlipType) ,y, Image.Rotate(float) ,y, Image.Crop(Rectangle) ,y, Image.Crop(int, int, int, int) ,y, Image.Save() ,y, Image.Save(string) ,y, Image.Save(string, ImageOptionsBase) ,y, Image.Save(string, ImageOptionsBase, Rectangle) ,y, Image.Save(Stream, ImageOptionsBase) ,y, Image.Save(Stream, ImageOptionsBase, Rectangle) ,y, Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) ,y, Image.SetPalette(IColorPalette, bool) ,y, Image.BitsPerPixel ,y, Image.Bounds ,y, Image.Container ,y, Image.Height ,y, Image.Palette ,y, Image.UsePalette ,y, Image.Size ,y, Image.Width ,y, Image.InterruptMonitor ,y, Image.BufferSizeHint ,y, Image.AutoAdjustPalette ,y, Image.HasBackgroundColor ,y, Image.FileFormat ,y, Image.BackgroundColor ,y, DataStreamSupporter.CacheData() ,y, DataStreamSupporter.Save() ,y, DataStreamSupporter.Save(Stream) ,y, DataStreamSupporter.Save(string) ,y, DataStreamSupporter.Save(string, bool) ,y, DataStreamSupporter.DataStreamContainer ,y, DataStreamSupporter.IsCached ,y, DisposableObject.Dispose() ,y, DisposableObject.Disposed ,y, object.GetType() ,y, object.ToString() ,y, object.Equals(object?) ,y, object.Equals(object?, object?) ,y, object.ReferenceEquals(object?, object?) ,y, object.GetHashCode()
Examples
Acceso a las notas del fabricante de la cámara en la imagen de 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);
}
}
El ejemplo muestra cómo cargar un JpegImage de un archivo.
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(El string)
La clase Aspose.Imaging.FileFormats.Jpeg.JpegImage inicia sin esfuerzo invocando suConstructor con el parámetro de ruta especificado.Este constructor permiteCreación de imágenes JPEG, garantizando la rápida integración en sus proyectos con facilidad.
public JpegImage(string path)
Parameters
path
string
El camino para cargar la imagen y iniciar los datos de píxeles y paletas con.
Examples
El ejemplo muestra cómo cargar un JpegImage de un archivo.
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)
Iniciar un objeto de imagen JPEG con la clase Aspose.Imaging.FileFormats.Jpeg.JpegImage utilizando unEste constructor simplifica el proceso de trabajo con JPEGimágenes, que ofrecen un enfoque sencillo para integrarlas en sus proyectossin esfuerzo.
public JpegImage(Stream stream)
Parameters
stream
Stream
El flujo para cargar la imagen y iniciar los datos de píxeles y paletas con.
Examples
El ejemplo muestra cómo cargar un JpegImage de un flujo de archivos.
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)
Iniciar una nueva instancia de la clase Aspose.Imaging.FileFormats.Jpeg.JpegImage con una imagen de rasterEste constructor proporciona una manera conveniente de crear imágenes JPEGdirectamente de imágenes raster, simplificando el flujo de trabajo para trabajar con imágenes JPEGen sus aplicaciones.
public JpegImage(RasterImage rasterImage)
Parameters
rasterImage
RasterImage
La imagen para iniciar los pixel y los datos de paleta con.
Examples
El ejemplo muestra cómo cargar un JpegImage de otro 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(El int, int)
Crea una nueva instancia de la clase Aspose.Imaging.FileFormats.Jpeg.JpegImage con la anchura especificaday parámetros de altura. este constructor le permite crear imágenes JPEG condimensiones personalizadas, lo que le da flexibilidad en la gestión de tamaños de imagen en su aplicación.
public JpegImage(int width, int height)
Parameters
width
int
La imagen es amplia.
height
int
La altura de la imagen.
Examples
El siguiente ejemplo muestra cómo crear una imagen JPEG del tamaño especificado.
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");
}
El siguiente ejemplo carga una imagen BMP y la salva a JPEG utilizando varias opciones de almacenamiento.
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)
Iniciar un nuevo objeto Aspose.Imaging.FileFormats.Jpeg.JpegImage con las opciones de JPEG proporcionadas.Este constructor le permite ajustar varias configuraciones para la imagen JPEG, tales comocomo nivel de compresión, calidad y parámetros adicionales, proporcionando control precisosobre el formato de imagen resultante.
public JpegImage(JpegOptions jpegOptions, int width, int height)
Parameters
jpegOptions
JpegOptions
Las opciones de jpeg.
width
int
Imagen de amplitud.
height
int
La altura de la imagen.
Examples
El siguiente ejemplo carga una imagen BMP y la salva a JPEG utilizando varias opciones de almacenamiento.
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);
}
El siguiente ejemplo muestra cómo crear una imagen JPEG del tamaño especificado con los parámetros especificados.
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
Retire la profundidad del pixel de la imagen sin esfuerzo con esta propiedad, ofreciendola riqueza de la representación de color o gris. si es unauna fotografía vibrante o una ilustración monocroma, esta propiedad proporciona unainformación sobre la complejidad visual de la imagen.
public override int BitsPerPixel { get; }
Valor de la propiedad
CmykColorProfile
El perfil de color CMYK asociado con las imágenes CMYK y YCCK JPEG garantiza la precisiónConversión de color y fidelidad. funciona en conjunto con el RGBColorProfile paragarantizar una representación de color exacta a través de diversos dispositivos y aplicaciones.Esta pareja es crucial para mantener la coherencia en el rendimiento de colores yObtener la calidad óptima de la imagen.
public StreamSource CmykColorProfile { get; set; }
Valor de la propiedad
Examples
El siguiente ejemplo carga PNG y lo salva a CMYK JPEG utilizando el perfil ICC personalizado. Luego carga CMYK JPEG y lo salva de nuevo a PNG. La conversión de color de RGB a CMYK y de CMYK a RGB se realiza utilizando los perfiles ICC personalizados.
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
Gestión de comentarios de archivo JPEG con esta propiedad, lo que le permite agregar o recuperaranotaciones descriptivas asociadas con la imagen. si es etiquetando imágenes conmetadatos o apagando un contexto adicional, esta propiedad ofrece flexibilidad enOrganizar y categorizar sus archivos JPEG.
public string Comment { get; set; }
Valor de la propiedad
DestinationCmykColorProfile
El perfil de color CMYK es vital para la conversión de color exacta de CMYK y YCCKImágenes JPEG durante el proceso de ahorro. funciona en tandem con el RGBColorProfilegarantizar la correcta representación de los colores, manteniendo la coherencia y la calidaddiferentes dispositivos y software. esta sincronización es crucial para lograrrenderización de color exacta y fiable en las últimas imágenes guardadas.
public StreamSource DestinationCmykColorProfile { get; set; }
Valor de la propiedad
DestinationRgbColorProfile
El RGBColorProfile es esencial para la conversión de color exacta de CMYK y YCCKImágenes JPEG durante el proceso de ahorro.Cuando parado con el CMYKColorProfile, segarantiza que los colores se renderan correctamente y mantiene la coherencia entrediferentes dispositivos y aplicaciones. esta combinación es crucial para preservar elrepresentación de colores y la obtención de una producción de imagen de alta calidad.
public StreamSource DestinationRgbColorProfile { get; set; }
Valor de la propiedad
ExifData
Gestión de datos EXIF con esta propiedad, lo que le permite agregar o recuperar metadatosrelacionado con la imagen. si se extrae información sobre la cámaraconfiguración o modificación de metadatos existentes, esta propiedad ofrece flexibilidad enGestión del contenedor de datos EXIF.
public JpegExifData ExifData { get; set; }
Valor de la propiedad
Examples
El siguiente ejemplo muestra cómo extraer las etiquetas EXIF de una imagen 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
Recuperar el formato de la imagen sin esfuerzo con esta propiedad.información valiosa sobre el formato de archivo, ayudando a la integración sin sentido yVerifica la compatibilidad a través de diferentes plataformas y aplicaciones.
public override FileFormat FileFormat { get; }
Valor de la propiedad
Height
Retire la altura de la imagen sin esfuerzo con esta propiedad.acceso a la dimensión vertical de la imagen, lo que le permitedeterminar su proporción de tamaño y aspecto sin la necesidad de cálculos complejos ométodos adicionales.
public override int Height { get; }
Valor de la propiedad
HorizontalResolution
Esta propiedad le permite acceder a la resolución horizontal de laAspose.Imaging.RasterImage, medido en píxeles por pulgón.este valor, puede controlar con precisión la resolución de la imagen, garantizandocumplen sus requisitos específicos para la calidad y la claridad.
public override double HorizontalResolution { get; set; }
Valor de la propiedad
Examples
El siguiente ejemplo muestra cómo configurar la resolución horizontal/vertical de una imagen 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
Nota por defecto este valor es siempre 96 ya que las diferentes plataformas no pueden devolver la resolución de la pantalla. Puede considerar utilizar el método SetResolution para actualizar ambos valores de resolución en una sola llamada.
IgnoreEmbeddedColorProfile
Retirar o modificar la bandera señalando si el perfil de color incorporado esmediante la configuración de esta bandera, los usuarios pueden especificar si el color estándardebe utilizarse el perfil en lugar del integrado. esta opción garantiza una mayorcontrol sobre la gestión del color, facilitando ajustes para la coherencia ycompatibilidad a través de diferentes plataformas y aplicaciones.
public bool IgnoreEmbeddedColorProfile { get; set; }
Valor de la propiedad
Jfif
Esta propiedad le permite acceder o modificar el JFIF (JPEG File Interchange)Format) datos asociados con la imagen JPEG. JFIF es un formato estándar paraintercambiar imágenes comprimidas por JPEG entre ordenadores y otros dispositivos.o configurar esta propiedad, puede interactuar con los datos JFIF, que pueden incluirinformación como la resolución de la imagen, la relación de aspecto y el detalle.
public JFIFData Jfif { get; set; }
Valor de la propiedad
JpegOptions
Obtener acceso a las opciones JPEG empleadas durante la creación o carga de esteAspose.Imaging.FileFormats.Jpeg.JpegImage instancia con facilidad. Esta propiedad ofrece preciosos detallessobre las configuraciones específicas utilizadas, que permiten a los usuarios comprender y replicarprocesamiento de imágenes flujos de trabajo de manera efectiva. si es nivel de compresión, calidadconfiguraciones, o otros parámetros, esta propiedad proporciona insights esenciales paraLa manipulación de la imagen.
public JpegOptions JpegOptions { get; }
Valor de la propiedad
Examples
El siguiente ejemplo muestra cómo extraer la información del título de una imagen 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
Esta propiedad recoge el formato de datos crudo de la imagen, que indica cómoLos datos de la imagen son estructurados y codificados. comprender el formato de datos crudos eses esencial para el tratamiento o manipulación de los datos de imagen de manera efectiva.la representación subyacente de la imagen, por ejemplo, si esComprimido, codificado en un espacio de color específico, o almacenado en un archivo específicoEl acceso a esta propiedad le permite obtener información valiosa sobre elestructura de datos de la imagen, lo que le permite realizar diferentes operaciones o optimizacionesadaptado a su formato específico.
public override PixelDataFormat RawDataFormat { get; }
Valor de la propiedad
RgbColorProfile
El perfil de color RGB para imágenes CMYK y YCCK JPEG garantiza el color exactoconversión y representación. debe ser parado con el CMYKColorProfile paramantener la coherencia y la fidelidad en el rendimiento de colores. esta pareja es esencial paraaplicaciones que requieren una gestión de color precisa y reproducción de imágenes,garantizar que los datos RGB se interpreten y se muestren correctamente.
public StreamSource RgbColorProfile { get; set; }
Valor de la propiedad
Examples
El siguiente ejemplo carga PNG y lo salva a CMYK JPEG utilizando el perfil ICC personalizado. Luego carga CMYK JPEG y lo salva de nuevo a PNG. La conversión de color de RGB a CMYK y de CMYK a RGB se realiza utilizando los perfiles ICC personalizados.
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
Esta propiedad gestiona la resolución vertical, expresada en píxeles por pulgón, parael asociado Aspose.Imaging.RasterImage. ajustando esta resolución afecta a latamaño y calidad de la imagen cuando se imprime o se muestra a un tamaño físico fijo.Al configurar esta propiedad, usted controla la densidad de los píxeles de la imagen.verticalmente, afectando su agudez y claridad general.
public override double VerticalResolution { get; set; }
Valor de la propiedad
Examples
El siguiente ejemplo muestra cómo configurar la resolución horizontal/vertical de una imagen 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
Nota por defecto este valor es siempre 72 ya que las diferentes plataformas no pueden devolver la resolución de la pantalla. Puede considerar utilizar el método SetResolution para actualizar ambos valores de resolución en una sola llamada.
Width
Esta propiedad retrata la anchura de la imagen, expresada en píxeles.información esencial sobre las dimensiones de la imagen, permitiendo renderización exacta,manipulación, o muestra de los datos de la imagen.
public override int Width { get; }
Valor de la propiedad
XmpData
Recibe o establece metadatos XMP, lo que permite la integración sin sentido deinformación descriptiva en el archivo de imagen. si está extrayendo el XMP existentemetadatos o actualizarlos con nueva información, esta propiedad simplifica laGestión de metadatos extendidos, garantizando la compatibilidad con diferentes aplicacionesy los flujos de trabajo.
public override XmpPacketWrapper XmpData { get; set; }
Valor de la propiedad
Methods
AutoRotate()
Rotará automáticamente la imagen basada en los datos de orientación extraídos de ExifEste método garantiza que las imágenes se muestran en la dirección correcta,mejorar la experiencia del usuario y eliminar la necesidad de ajustes manuales.analizando la información de Exif, la imagen se rota de acuerdo, proporcionando unExperiencia de visualización a través de diferentes plataformas y dispositivos. esta rotación automatizadaEl proceso simplifica el manejo de la imagen y mejora la usabilidad general, especialmente cuandoTratar con grandes lotes de imágenes con diferentes orientaciones.
public void AutoRotate()
Exceptions
El valor de ‘Orientación’ de ‘JpegExifData’ está fuera del alcance permitido [1…8], por lo que la rotación automática no puede ser aplicada.
GetModifyDate(BOOL)
Retira la fecha y hora en que la imagen de la fuente sufrió su últimaEste método proporciona metadatos valiosos, lo que permite a los usuarios rastrear ygestionar las actualizaciones al archivo de imagen de manera efectiva. al acceder a esta información, los usuariospuede garantizar la integridad y moneda de sus activos de imagen, facilitando latoma de decisiones sobre el uso y el mantenimiento de la imagen.
public override DateTime GetModifyDate(bool useDefault)
Parameters
useDefault
bool
si se establece a ‘verdad’ utiliza la información de FileInfo como valor predeterminado.
Returns
La fecha y hora de la imagen de la fuente fue modificada por última vez.
ReleaseManagedResources()
Asegúrese de que los recursos no gestionados no se liberan aquí, ya que pueden haber sido ya liberados.
protected override void ReleaseManagedResources()
RemoveMetadata()
Elimina estos metadatos de instancia de la imagen al configurar los valores de Aspose.Imaging.Xmp.IHasXMPData.xmpDat y Wl17.Exif. Nula.
public override void RemoveMetadata()
SaveData(Stream)
ahorrar los datos.
protected override void SaveData(Stream stream)
Parameters
stream
Stream
El flujo para salvar los datos a.
SetResolution(doble, doble)
Establece la resolución para el Aspose.Imaging.RasterImage especificado, garantizandocapacidades de escalada y impresión precisas.Este método permite a los usuarios ajustarla resolución de la imagen para satisfacer sus requisitos específicos, ya sea para lamuestra o reproducción física. mediante la configuración de la resolución, los usuarios pueden optimizarcalidad de la imagen y garantizar la compatibilidad con varios dispositivos de salida y medios,Mejorar la experiencia visual general y la usabilidad de la imagen.
public override void SetResolution(double dpiX, double dpiY)
Parameters
dpiX
double
La resolución horizontal, en puntos por pulgón, del Aspose.Imaging.RasterImage.
dpiY
double
La resolución vertical, en puntos por pulgón, del Aspose.Imaging.RasterImage.
Examples
El siguiente ejemplo muestra cómo configurar la resolución horizontal/vertical de una imagen 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(El int, int)
Actualizar las dimensiones de la imagen.
protected override void UpdateDimensions(int newWidth, int newHeight)
Parameters
newWidth
int
La nueva imagen es amplia.
newHeight
int
El nuevo tamaño de la imagen.
UpdateMetadata()
Actualizar los metadatos de la imagen.
protected override void UpdateMetadata()