public LeadSize[] ReadLoadResolutions(
string fileName,
int pageNumber
)
- (nullable NSArray<NSValue/*CGSize*/ *> *)loadResolutionsForFile:(NSString *)file
pageNumber:(NSInteger)pageNumber
error:(NSError **)error
public:
array<LeadSize>^ ReadLoadResolutions(
String^ fileName,
int pageNumber
)
def ReadLoadResolutions(self,fileName,pageNumber):
fileName
A String containing the name of the file to query.
pageNumber
An Int32 that indicates the page number.
A LeadSize structure containing the available resolutions.
A FlashPix, PhotoCD, JPEG 2000 or JBIG/JBIG2 file can contain more than one copy of the same image, each at a different physical resolution (width and height in pixels).
multipage files (like TIF) containing compressions listed above (eg: JPEG 2000 or JBIG/JBIG2) can also contain more than one copy of the same image, each at a different physical resolution (width and height in pixels).
After you get the available resolutions, you can use any of the following to specify the one to be loaded:
The pages numbers start with 1, so set pageNumber to 2 to read the resolutions from the second page. If you set pageNumber to 1, the function behaves like the equivalent function without the pageNumber parameter.
For more information, refer to Implementing JBIG Features.
This example shows how many physical resolutions are available in page 2, selects the smallest one, then loads the file.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
void ReadLoadResolutionsTiffExample(string tiffFileName, int pageNumber)
{
RasterCodecs codecs = new RasterCodecs();
// Get the number of resolutions (sizes) available in second page of this file
// Make sure you run this for a tiff file with 2 pages, second page using JPEG 2000 compression
LeadSize[] resolution = codecs.ReadLoadResolutions(tiffFileName, pageNumber);
if (resolution.Length > 0)
{
Debug.WriteLine("{0} resolutions available", resolution.Length);
for (int i = 0; i < resolution.Length; i++)
Debug.WriteLine("{0}: {1} by {2}", i, resolution[i].Width, resolution[i].Height);
// Set the size to load, the smallest size in this case */
codecs.Options.Tiff.Load.J2kResolution = resolution[resolution.Length - 1];
// Get the info in of the image to show its original size
CodecsImageInfo info = codecs.GetInformation(tiffFileName, false, pageNumber);
Debug.WriteLine("Size of image according to GetInformation is {0} by {1}", info.Width, info.Height);
// Load the image, keeping the bits per pixel of the file
RasterImage image = codecs.Load(tiffFileName, pageNumber);
Debug.WriteLine("Size of image loaded is {0} by {1}", image.Width, image.Height);
image.Dispose();
}
else
Debug.WriteLine("No resolutions found");
// Clean up
codecs.Dispose();
}
import java.io.*;
import java.net.*;
import java.nio.file.Paths;
import java.util.*;
import java.time.Instant;
import java.time.Duration;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.codecs.RasterCodecs.FeedCallbackThunk;
import leadtools.drawing.internal.*;
import leadtools.imageprocessing.*;
import leadtools.imageprocessing.color.ChangeIntensityCommand;
import leadtools.svg.*;
public void readLoadResolutionsTiffExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
String tiffFileName = "jbig.jbg";
System.out.println(combine(LEAD_VARS_IMAGES_DIR, tiffFileName));
int pageNumber = 1;
RasterCodecs codecs = new RasterCodecs();
// Get the number of resolutions (sizes) available in second page of this file
// Make sure you run this for a tiff file with 2 pages, second page using JPEG
// 2000 compression
ILeadStream ls = LeadStreamFactory.create(combine(LEAD_VARS_IMAGES_DIR, tiffFileName));
LeadSize[] resolution = codecs.readLoadResolutions(ls, pageNumber);
if (resolution.length > 0) {
System.out.println(resolution.length + " resolutions available");
for (int i = 0; i < resolution.length; i++)
System.out.println(i + ": " + resolution[i].getWidth() + " by " + resolution[i].getHeight());
// Get the info in of the image to show its original size
CodecsImageInfo info = codecs.getInformation(ls, false, pageNumber);
System.out
.println("Size of image according to GetInformation is " + info.getWidth() + " by " + info.getHeight());
// Load the image, keeping the bits per pixel of the file
RasterImage image = codecs.load(ls, pageNumber);
System.out.println("Size of image loaded is " + image.getWidth() + " by " + image.getHeight());
image.dispose();
} else
System.out.println("No resolutions found");
// Clean up
codecs.dispose();
}
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