Leadtools.Codecs名前空間 > RasterCodecsクラス > GetInformationメソッド :GetInformation(String、Boolean)メソッド |
public CodecsImageInfo GetInformation( string fileName, bool totalPages )
'Declaration
Public Overloads Function GetInformation( _ ByVal fileName As String, _ ByVal totalPages As Boolean _ ) As CodecsImageInfo
'Usage
Dim instance As RasterCodecs Dim fileName As String Dim totalPages As Boolean Dim value As CodecsImageInfo value = instance.GetInformation(fileName, totalPages)
public CodecsImageInfo GetInformation( string fileName, bool totalPages )
- (nullable LTCodecsImageInfo *)imageInformationForFile:(NSString *)file totalPages:(BOOL)totalPages error:(NSError **)error
function Leadtools.Codecs.RasterCodecs.GetInformation(String,Boolean)( fileName , totalPages )
public: CodecsImageInfo^ GetInformation( String^ fileName, bool totalPages )
totalPagesにtrueを指定すると、ページ数の多いファイルのためプロセスは遅くなります。
速くimageの数を問い合わせるために、GetTotalPagesまたはGetTotalPagesAsyncを使います。
速くimageの形式を問い合わせるために、GetFormatまたはGetFormatAsyncを使います。
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Color Imports Leadtools.Drawing Imports Leadtools.Svg Public Sub GetInformationStringExample() Dim codecs As RasterCodecs = New RasterCodecs() ' Get Information on a GIF image file and write it out Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif") Dim info As CodecsImageInfo = codecs.GetInformation(srcFileName, True) Console.WriteLine("Information for: {0}", srcFileName) Console.WriteLine(String.Format("BitsPerPixel: {0}", info.BitsPerPixel)) Console.WriteLine(String.Format("BytesPerLine: {0}", info.BytesPerLine)) Console.WriteLine(String.Format("ColorSpace: {0}", info.ColorSpace.ToString())) Console.WriteLine(String.Format("Compresion: {0}", info.Compression)) Console.WriteLine(String.Format("Fax: {0}", info.Fax)) Console.WriteLine(String.Format("Format: {0}", info.Format)) If info.Gif.HasAnimationBackground Then Console.WriteLine(String.Format("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString())) End If Console.WriteLine(String.Format("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight)) Console.WriteLine(String.Format("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth)) If info.Gif.HasAnimationLoop Then Console.WriteLine(String.Format("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString())) End If If info.Gif.HasAnimationPalette Then Dim pal As RasterColor() = info.Gif.GetAnimationPalette() Console.WriteLine("GifAnimationPalette:" & Constants.vbLf) Dim x As Integer = 0 Do While x < pal.Length Console.Write("{0},", pal(x)) x += 1 Loop Console.WriteLine(Constants.vbLf) End If Console.WriteLine(String.Format("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString())) Console.WriteLine(String.Format("PageNumber: {0}", info.PageNumber)) Console.WriteLine(String.Format("TotalPages: {0}", info.TotalPages)) ' Clean up codecs.Dispose() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
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); Console.WriteLine("Information for: {0}", srcFileName); Console.WriteLine(string.Format("BitsPerPixel: {0}", info.BitsPerPixel)); Console.WriteLine(string.Format("BytesPerLine: {0}", info.BytesPerLine)); Console.WriteLine(string.Format("ColorSpace: {0}", info.ColorSpace.ToString())); Console.WriteLine(string.Format("Compresion: {0}", info.Compression)); Console.WriteLine(string.Format("Fax: {0}", info.Fax)); Console.WriteLine(string.Format("Format: {0}", info.Format)); if (info.Gif.HasAnimationBackground) Console.WriteLine(string.Format("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString())); Console.WriteLine(string.Format("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight)); Console.WriteLine(string.Format("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth)); if (info.Gif.HasAnimationLoop) Console.WriteLine(string.Format("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString())); if (info.Gif.HasAnimationPalette) { RasterColor[] pal = info.Gif.GetAnimationPalette(); Console.WriteLine("GifAnimationPalette:\n"); for (int x = 0; x < pal.Length; x++) { Console.Write("{0},", pal[x]); } Console.WriteLine("\n"); } Console.WriteLine(string.Format("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString())); Console.WriteLine(string.Format("PageNumber: {0}", info.PageNumber)); Console.WriteLine(string.Format("TotalPages: {0}", info.TotalPages)); // Clean up codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
RasterCodecsExamples.prototype.GetInformationStringExample = function () { Tools.SetLicense(); with (Leadtools) { with (Leadtools.Codecs) { var codecs = new RasterCodecs(); // Get Information on a GIF image file and write it out var srcFileName = "Assets\\eye.gif"; var image; return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) { var info = null; return codecs.getInformationAsync(LeadStreamFactory.create(loadFile), true, 1) }) .then(function (info) { console.info("Information for: ", srcFileName); console.info("BitsPerPixel: ", info.bitsPerPixel); console.info("BytesPerLine: ", info.bytesPerLine); console.info("ColorSpace: ", info.colorSpace.toString()); console.info("Compresion: ", info.compression); console.info("Fax: ", info.fax); console.info("Format: ", info.format); if (info.gif.hasAnimationBackground) console.info("Gif.AnimationBackground: ", RasterColorHelper.getStringDescription(info.gif.animationBackground)); console.info("Gif.AnimationHeight: ", info.gif.animationHeight); console.info("Gif.AnimationWidth: ", info.gif.animationWidth); if (info.gif.hasAnimationLoop) console.info("Gif.AnimationLoop: ", info.gif.animationLoop.toString()); if (info.gif.hasAnimationPalette) { var pal = info.gif.getAnimationPalette(); console.info("GifAnimationPalette:"); for (var x = 0; x < pal.length; x++) { console.info(RasterColorHelper.getStringDescription(pal[x])); } console.info("\n"); } console.info("Gif.IsInterlaced: ", info.gif.isInterlaced.toString()); console.info("PageNumber: ", info.pageNumber); console.info("TotalPages: ", info.totalPages); // Clean up codecs.close(); }, function (ex) { var error = ""; var rasterException = RasterException.fromHResult(ex.number); if (rasterException != null) error = rasterException.message; else error = ex.message; console.info(error); }); } } }
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Color; public async Task GetInformationStringExample() { RasterCodecs codecs = new RasterCodecs(); // Get Information on a GIF image file and write it out string srcFileName = @"Assets\eye.gif"; StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); CodecsImageInfo info = null; try { info = await codecs.GetInformationAsync(LeadStreamFactory.Create(loadFile), true, 1); } catch (Exception ex) { string error=""; RasterException rasterException = RasterException.FromHResult(ex.HResult); if (rasterException != null) error = rasterException.Message; else error = ex.Message; Debug.WriteLine(error); Assert.Fail(error); } Debug.WriteLine("Information for: {0}", srcFileName); Debug.WriteLine(string.Format("BitsPerPixel: {0}", info.BitsPerPixel)); Debug.WriteLine(string.Format("BytesPerLine: {0}", info.BytesPerLine)); Debug.WriteLine(string.Format("ColorSpace: {0}", info.ColorSpace.ToString())); Debug.WriteLine(string.Format("Compresion: {0}", info.Compression)); Debug.WriteLine(string.Format("Fax: {0}", info.Fax)); Debug.WriteLine(string.Format("Format: {0}", info.Format)); if (info.Gif.HasAnimationBackground) Debug.WriteLine(string.Format("Gif.AnimationBackground: {0}", RasterColorHelper.GetStringDescription(info.Gif.AnimationBackground))); Debug.WriteLine(string.Format("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight)); Debug.WriteLine(string.Format("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth)); if (info.Gif.HasAnimationLoop) Debug.WriteLine(string.Format("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++) { Debug.WriteLine(RasterColorHelper.GetStringDescription(pal[x])); } Debug.WriteLine("\n"); } Debug.WriteLine(string.Format("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString())); Debug.WriteLine(string.Format("PageNumber: {0}", info.PageNumber)); Debug.WriteLine(string.Format("TotalPages: {0}", info.TotalPages)); // Clean up codecs.Dispose(); }