←Select platform

Jp2Resolution Property

Summary
Gets or sets the resolution to load when loading JP2 files.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public LeadSize Jp2Resolution { get; set; } 
@property (nonatomic, assign) LeadSize jp2Resolution; 
public LeadSize getJp2Resolution() 
public void setJp2Resolution(LeadSize value) 
public: 
property LeadSize Jp2Resolution { 
   LeadSize get(); 
   void set (    LeadSize ); 
} 
Jp2Resolution # get and set (CodecsJpeg2000LoadOptions) 

Property Value

The resolution to load. The default value is 0,0.

Remarks

Specifies the resolution of the image to load. You can specify 0 to get the default.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
 
using Leadtools.ImageProcessing.Core; 
 
public void CodecsJpeg2000OptionsExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.j2k"); 
 
   CodecsJpeg2000PrecinctSize[] precintSizes = (CodecsJpeg2000PrecinctSize[])Enum.GetValues(typeof(CodecsJpeg2000PrecinctSize)); 
   foreach (var precinctSize in precintSizes) 
   { 
      Console.WriteLine($"PrecinctSize types: {precinctSize}"); 
   } 
 
   //Setting the Jpeg2000 load options. CodecsJpeg2000Options & CodecsJpeg2000LoadOptions reference 
   codecs.Options.Jpeg2000.Load.J2kResolution = new LeadSize(800, 800); 
   codecs.Options.Jpeg2000.Load.Jp2Resolution = new LeadSize(800, 800); 
   codecs.Options.Jpeg2000.Load.CmwResolution = new LeadSize(0, 0); 
 
   //loading a Jpeg2000 image. 
   RasterImage srcImage = codecs.Load(srcFileName); 
 
   //Setting the Jpeg2000 save options. CodecsJpeg2000SaveOptions reference 
   codecs.Options.Jpeg2000.Save.AlphaChannelActiveBits = 16; 
   codecs.Options.Jpeg2000.Save.AlphaChannelLossless = false; 
   codecs.Options.Jpeg2000.Save.CompressionControl = CodecsJpeg2000CompressionControl.Ratio; 
   codecs.Options.Jpeg2000.Save.CompressionRatio = 15.0f; 
   codecs.Options.Jpeg2000.Save.DecompositionLevels = 5; 
   codecs.Options.Jpeg2000.Save.DerivedQuantization = true; 
   codecs.Options.Jpeg2000.Save.ImageAreaHorizontalOffset = 0; 
   codecs.Options.Jpeg2000.Save.ImageAreaVerticalOffset = 0; 
   codecs.Options.Jpeg2000.Save.ProgressingOrder = CodecsJpeg2000ProgressionsOrder.PositionComponentResolutionLayer; 
   codecs.Options.Jpeg2000.Save.PrecinctSize = CodecsJpeg2000PrecinctSize.HierarchicalOne64; 
   codecs.Options.Jpeg2000.Save.ReferenceTileHeight = 240; 
   codecs.Options.Jpeg2000.Save.ReferenceTileWidth = 480; 
   codecs.Options.Jpeg2000.Save.RegionOfInterest = CodecsJpeg2000RegionOfInterest.UseLeadRegion; 
   codecs.Options.Jpeg2000.Save.RegionOfInterestRectangle = new LeadRect(0, 0, 0, 0); 
   codecs.Options.Jpeg2000.Save.TargetFileSize = 10240; 
   codecs.Options.Jpeg2000.Save.TileHorizontalOffset = 0; 
   codecs.Options.Jpeg2000.Save.TileVerticalOffset = 0; 
   codecs.Options.Jpeg2000.Save.UseColorTransform = true; 
   codecs.Options.Jpeg2000.Save.UseEphMarker = false; 
   codecs.Options.Jpeg2000.Save.UseRegionOfInterest = false; 
   codecs.Options.Jpeg2000.Save.UseSopMarker = false; 
 
   //Save the first sample. 
   codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "Image1_test.j2k"), RasterImageFormat.J2k, srcImage.BitsPerPixel); 
   codecs.Options.Jpeg2000.Save.Reset(); 
 
   //changing some of the Jpeg2000 save options 
   codecs.Options.Jpeg2000.Save.CompressionRatio = 23.0f; 
   codecs.Options.Jpeg2000.Save.DecompositionLevels = 6; 
   codecs.Options.Jpeg2000.Save.ReferenceTileHeight = 320; 
   codecs.Options.Jpeg2000.Save.ReferenceTileWidth = 320; 
   codecs.Options.Jpeg2000.Save.UseEphMarker = true; 
   codecs.Options.Jpeg2000.Save.ProgressingOrder = CodecsJpeg2000ProgressionsOrder.ResolutionPositionComponentLayer; 
   codecs.Options.Jpeg2000.Save.UseSopMarker = true; 
   codecs.Options.Jpeg2000.Save.TargetFileSize = 102400; 
 
   var maximumComponentsNumber = CodecsJpeg2000SaveOptions.MaximumComponentsNumber; 
   var maximumDecompressionLevels = CodecsJpeg2000SaveOptions.MaximumDecompressionLevels; 
   Console.WriteLine("MaximumComponents: {0}, MaximumDecompressionLevels: {1}", maximumComponentsNumber, maximumDecompressionLevels); 
 
   //Save the first sample. 
   codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "Image1_test.jp2"), RasterImageFormat.J2k, srcImage.BitsPerPixel); 
 
   // Clean up 
   srcImage.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.