JpegOptions class

The jpeg file format create options.

public class JpegOptions : ImageOptionsBase


Name Description
JpegOptions() Initializes a new instance of the JpegOptions class.
JpegOptions(JpegOptions) Initializes a new instance of the JpegOptions class.


Name Description
BitsPerChannel { get; set; } Gets or sets bits per channel for lossless jpeg image. Now we support from 2 to 8 bits per channel.
BufferSizeHint { get; set; } Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
CmykColorProfile { get; set; } The destination CMYK color profile for CMYK jpeg images. Use for saving images. Must be in pair with RGBColorProfile for correct color conversion.
ColorType { get; set; } Gets or sets the color type for jpeg image.
Comment { get; set; } Gets or sets the jpeg file comment.
CompressionType { get; set; } Gets or sets the compression type.
virtual DefaultReplacementFont { get; set; } Gets or sets the default replacement font (font that will be used to draw text when exporting to raster, if existing layer font in PSD file is not presented in system). To take proper name of default font can be used next code snippet: System.Drawing.Text.InstalledFontCollection col = new System.Drawing.Text.InstalledFontCollection(); System.Drawing.FontFamily[] families = col.Families; string defaultFontName = families[0].Name; PsdLoadOptions psdLoadOptions = new PsdLoadOptions() { DefaultReplacementFont = defaultFontName });
Disposed { get; } Gets a value indicating whether this instance is disposed.
ExifData { get; set; } Get or set exif data container
FullFrame { get; set; } Gets or sets a value indicating whether [full frame].
HorizontalSampling { get; set; } Gets or sets the horizontal subsamplings for each component.
Jfif { get; set; } Gets or sets the jfif.
JpegLsAllowedLossyError { get; set; } Gets or sets the JPEG-LS difference bound for near-lossless coding (NEAR parameter from the JPEG-LS specification).
JpegLsInterleaveMode { get; set; } Gets or sets the JPEG-LS interleave mode.
JpegLsPreset { get; set; } Gets or sets the JPEG-LS preset parameters.
MultiPageOptions { get; set; } The multipage options
virtual Palette { get; set; } Gets or sets the color palette.
PreblendAlphaIfPresent { get; set; } Gets or sets a value indicating whether red, green and blue components should be mixed with a background color, if alpha channel is present.
ProgressEventHandler { get; set; } Gets or sets the progress event handler.
Quality { get; set; } Gets or sets image quality.
RdOptSettings { get; set; } Gets or sets the RD optimizer settings.
virtual ResolutionSettings { get; set; } Gets or sets the resolution settings.
ResolutionUnit { get; set; } Gets or sets the resolution unit.
RgbColorProfile { get; set; } The destination RGB color profile for CMYK jpeg images. Use for saving images. Must be in pair with CMYKColorProfile for correct color conversion.
SampleRoundingMode { get; set; } Gets or sets the sample rounding mode to fit an 8-bit value to an n-bit value. BitsPerChannel
ScaledQuality { get; } The scaled quality.
Source { get; set; } Gets or sets the source to create image in.
VectorRasterizationOptions { get; set; } Gets or sets the vector rasterization options.
VerticalSampling { get; set; } Gets or sets the vertical subsamplings for each component.
override XmpData { get; set; } Gets or sets the XMP metadata container.


Name Description
virtual Clone() Clones this instance.
Dispose() Disposes the current instance.


This example demonstrates the use of Aspose.PSD for .Net API to convert Images to Jpeg format. To achieve this goal this example loads an existing image and then converts it to Jpeg file format.


//Creates an instance of image class and initialize it with an existing file through File path
using (Aspose.PSD.Image image = Aspose.PSD.Image.Load(@"C:\temp\image.psd"))
    //Create an instance of PsdOptions class
    Aspose.PSD.ImageOptions.JpegOptions jpegOptions = new Aspose.PSD.ImageOptions.JpegOptions();

    //Set the quality to 50% to lower size of output image.
    jpegOptions.Quality = 50;

    //Set the exif comments.
    jpegOptions.ExifData = new Aspose.PSD.Exif.JpegExifData();
    jpegOptions.ExifData.Copyright = "This file was created using some custom engine. All rights reserved.";

    //Save the image to disk location with supplied JpegOptions settings
    image.Save(@"C:\temp\output.jpeg", jpegOptions);

This example demonstrates the use of System.IO.Stream to Create a new Image file


//Creates an instance of PsdOptions and set its various properties
Aspose.PSD.ImageOptions.PsdOptions psdOptions = new Aspose.PSD.ImageOptions.PsdOptions();

//Create an instance of System.IO.Stream
System.IO.Stream stream = new System.IO.FileStream(@"C:\temp\sample.psd", System.IO.FileMode.Create);

//Define the source property for the instance of PsdOptions
//Second boolean parameter determins if the Stream is disposed once get out of scope
psdOptions.Source = new Aspose.PSD.Sources.StreamSource(stream, true);

//Creates an instance of Image and call Create method with PsdOptions as parameter to initialize the Image object   
using (Aspose.PSD.Image image = Aspose.PSD.Image.Create(psdOptions, 500, 500))
    //do some image processing

This example demonstrates the use of different classes from SaveOptions Namespace for export purposes. An image of type Psd is loaded into an instance of Image and then exported out to several formats.


//Load an existing image in an instance of Image class
using (Aspose.PSD.Image image = Aspose.PSD.Image.Load(@"C:\temp\image.psd"))
    //Export to BMP file format using the default options
    image.Save(@"C:\temp\output.bmp", new Aspose.PSD.ImageOptions.BmpOptions());

    //Export to JPEG file format using the default options
    image.Save(@"C:\temp\output.jpeg", new Aspose.PSD.ImageOptions.JpegOptions());

    //Export to JPEG 2000 file format using the default options
    image.Save(@"C:\temp\output.jp2", new Aspose.PSD.ImageOptions.Jpeg2000Options());

    //Export to PNG file format using the default options
    image.Save(@"C:\temp\output.png", new Aspose.PSD.ImageOptions.PngOptions());

    //Export to TIFF file format using the default options
    image.Save(@"c:\temp\output.tiff", new Aspose.PSD.ImageOptions.TiffOptions(Aspose.PSD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default));

See Also