public int Passes { get; set; }
@property (nonatomic, assign) NSInteger passes;
public int getPasses()
public void setPasses(int value)
Passes # get and set (CodecsJpegSaveOptions)
The number of passes (scans through the image) when saving a progressive JPEG or LEAD CMP file.
Value | Description |
---|---|
> 1 | Save the file as a progressive file with the specified number of passes. |
1 | Save a regular JPEG file with dynamically optimized Huffman tables (i.e. the Huffman tables are optimized for the image you are saving). Use this for smaller file size (at the expense of speed). |
0 | Save a regular JPEG file with static Huffman tables (i.e. the Huffman tables are the same for all images). The default value is 0 . |
< 0 | Save the file as a progressive file with the LEADTOOLS default number of passes. |
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
public void CodecsJpegOptionsExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg");
// Get all Information about the Jpeg file that you want to load.
CodecsImageInfo imageInfo = codecs.GetInformation(srcFileName, true);
//Setting Jpeg Load options. CodecsJpegOptions & CodecsJpegLoadOptions reference
codecs.Options.Jpeg.Load.DisableMmx = false;
codecs.Options.Jpeg.Load.DisableP3 = false;
codecs.Options.Jpeg.Load.ForceCieLab = true;
codecs.Options.Jpeg.Load.ForceRgbFile = false;
codecs.Options.Jpeg.Load.IgnoreAdobeColorTransform = false;
codecs.Options.Jpeg.Load.UseBadJpegPredictor = false;
codecs.Options.Jpeg.Load.Multithreaded = true;
codecs.Options.Jpeg.Load.UseFastConversion = false;
RasterImage srcImage = codecs.Load(srcFileName);
//if the image has stamp then set the Jpeg settings related to the stamp.
if (imageInfo.Jpeg.HasStamp)
{
// Note, codecs.Options.Jpeg.Save.SaveWithoutTimestamp is deprecated. Use CodecsPngSaveOptions.SaveWithoutTimestamp instead.
// CodecsJpegSaveOptions reference
codecs.Options.Jpeg.Save.FixedPaletteStamp = true;
codecs.Options.Jpeg.Save.JpegStamp = true;
codecs.Options.Jpeg.Save.SaveWithStamp = true;
codecs.Options.Jpeg.Save.StampBitsPerPixel = srcImage.BitsPerPixel;
codecs.Options.Jpeg.Save.StampHeight = 100;
codecs.Options.Jpeg.Save.StampWidth = 100;
codecs.Options.Jpeg.Save.YccStamp = false;
}
if (imageInfo.Jpeg.IsLossless)
Debug.WriteLine("This is a lossless Jpeg Image");
else
Debug.WriteLine("This is not a lossless Jpeg Image");
if (imageInfo.Jpeg.IsProgressive)
codecs.Options.Jpeg.Save.Passes = 0;
codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.Custom;
codecs.Options.Jpeg.Save.DisableMmx = true;
codecs.Options.Jpeg.Save.DisableP3 = true;
codecs.Options.Jpeg.Save.QualityFactor = 2;
codecs.Options.Jpeg.Save.SaveOldJtif = true;
codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "jpeg1.jpg"), RasterImageFormat.Jpeg, srcImage.BitsPerPixel);
codecs.Options.Jpeg.Save.FixedPaletteStamp = false;
codecs.Options.Jpeg.Save.JpegStamp = true;
codecs.Options.Jpeg.Save.SaveWithStamp = true;
codecs.Options.Jpeg.Save.StampBitsPerPixel = srcImage.BitsPerPixel;
codecs.Options.Jpeg.Save.StampHeight = 75;
codecs.Options.Jpeg.Save.StampWidth = 50;
codecs.Options.Jpeg.Save.YccStamp = true;
codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.MaximumQuality;
codecs.Options.Jpeg.Save.DisableMmx = false;
codecs.Options.Jpeg.Save.DisableP3 = false;
codecs.Options.Jpeg.Save.SaveOldJtif = false;
codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "jpeg2.jpg"), RasterImageFormat.Jpeg, srcImage.BitsPerPixel);
// Clean up
srcImage.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.