public CodecsImageInfo GetInformation(
string fileName,
bool totalPages,
int pageNumber
)
- (nullable LTCodecsImageInfo *)imageInformationForFile:(NSString *)file
totalPages:(BOOL)totalPages
pageNumber:(NSInteger)pageNumber
error:(NSError **)error
public:
CodecsImageInfo^ GetInformation(
String^ fileName,
bool totalPages,
int pageNumber
)
def GetInformation(self,fileName,totalPages,pageNumber):
fileName
String containing the input file name to query.
totalPages
true to query the file for total number of pages; false, otherwise.
pageNumber
Page number in the file to query.
A CodecsImageInfo object that contains the information about the specified image.
Specifying true for totalPages can cause the process to be slow for files with large number of pages.
To quickly query the number of an image, use GetTotalPages or GetTotalPagesAsync.
To quickly query the format of an image, use GetFormat or GetFormatAsync.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
public void GetInformationStringExample()
{
RasterCodecs codecs = new RasterCodecs();
// Get Information on a GIF image file and write it out
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif");
CodecsImageInfo info = codecs.GetInformation(srcFileName, true);
Debug.WriteLine("Information for: {0}", srcFileName);
Debug.WriteLine("BitsPerPixel: {0}", info.BitsPerPixel);
Debug.WriteLine("BytesPerLine: {0}", info.BytesPerLine);
Debug.WriteLine("ColorSpace: {0}", info.ColorSpace.ToString());
Debug.WriteLine("Compression: {0}", info.Compression);
Debug.WriteLine("Fax: {0}", info.Fax);
Debug.WriteLine("Format: {0}", info.Format);
if (info.Gif.HasAnimationBackground)
Debug.WriteLine("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString());
Debug.WriteLine("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight);
Debug.WriteLine("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth);
if (info.Gif.HasAnimationLoop)
Debug.WriteLine("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString());
if (info.Gif.HasAnimationPalette)
{
RasterColor[] pal = info.Gif.GetAnimationPalette();
Debug.WriteLine("GifAnimationPalette:\n");
for (int x = 0; x < pal.Length; x++)
{
Console.Write("{0},", pal[x]);
}
Debug.WriteLine("\n");
}
Debug.WriteLine("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString());
Debug.WriteLine("PageNumber: {0}", info.PageNumber);
Debug.WriteLine("TotalPages: {0}", info.TotalPages);
// Clean up
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
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 getInformationStringExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
RasterCodecs codecs = new RasterCodecs();
// Get Information on a GIF image file and write it out
String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "eye.gif");
CodecsImageInfo info = codecs.getInformation(srcFileName, true);
System.out.println("Information for: " + srcFileName);
System.out.println("BitsPerPixel: " + info.getBitsPerPixel());
System.out.println("BytesPerLine: " + info.getBytesPerLine());
System.out.println("ColorSpace: " + info.getColorSpace().toString());
System.out.println("Compression: " + info.getCompression());
System.out.println("Fax: " + info.getFax());
System.out.println("Format: " + info.getFormat());
if (info.getGif().hasAnimationBackground()) {
System.out.println("Gif.AnimationBackground: " + info.getGif().getAnimationBackground().toString());
}
System.out.println("Gif.AnimationHeight: " + info.getGif().getAnimationHeight());
System.out.println("Gif.AnimationWidth: " + info.getGif().getAnimationWidth());
if (info.getGif().hasAnimationLoop()) {
System.out.println("Gif.AnimationLoop: " + info.getGif().getAnimationLoop());
}
if (info.getGif().hasAnimationPalette()) {
RasterColor[] pal = info.getGif().getAnimationPalette();
System.out.println("GifAnimationPalette:\n");
for (int x = 0; x < pal.length; x++) {
System.out.println(pal[x] + ",");
}
System.out.println("\n");
}
assertTrue(!info.getGif().isInterlaced());
System.out.println("Gif.IsInterlaced: " + info.getGif().isInterlaced());
assertTrue(info.getPageNumber() > 0);
System.out.println("PageNumber: " + info.getPageNumber());
assertTrue(info.getTotalPages() > 1);
System.out.println("TotalPages: " + info.getTotalPages());
// 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