←Select platform

IsFloat Property

Summary
Determines whether the image data is float.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public bool IsFloat { get; } 
@property (nonatomic, assign, readonly) BOOL IsFloat; 
public boolean IsFloat() 
public: 
property bool IsFloat { 
   bool get(); 
} 
IsFloat # get  (CodecsImageInfo) 

Property Value

true if the image data contains signed (negative) values; false, otherwise. The default value is false.

Floating point values are usually converted during load to integer values. You can avoid this conversion by setting CodecsLoadOptions.NoImageDataConversion = true to load the original floating point values. See Working With Floating Point Images for more details.

The floating point values can be positive or negative even when CodecsImageInfo.IsSigned is set to false.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
 
 
 
public void CodecsImageInfoIsFloatExample() 
{ 
   string srcFile = Path.Combine(LEAD_VARS.ImagesDir, "cannon_noisy.png"); 
   using (RasterCodecs codecs = new RasterCodecs()) 
   using (CodecsImageInfo info = codecs.GetInformation(srcFile, true)) 
   { 
      if (info.IsFloat) 
      { 
         Debug.WriteLine("The source file has floating point image data"); 
         codecs.Options.Load.NoImageDataConversion = true; 
         using (RasterImage image = codecs.Load(srcFile, 1)) 
         { 
            /* do something with the floating point image data */ 
         } 
      } 
      else 
         Debug.WriteLine("The source file does not have floating point image data"); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
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.*; 
 
 
public void codecsImageInfoIsFloatExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String srcFile = combine(LEAD_VARS_IMAGES_DIR, "cannon_noisy.png"); 
   RasterCodecs codecs = new RasterCodecs(); 
   CodecsImageInfo info = codecs.getInformation(srcFile, true); 
 
   if (info.isFloat()) { 
      System.out.println("The source file has floating point image data"); 
      codecs.getOptions().getLoad().setNoImageDataConversion(true); 
      RasterImage image = codecs.load(srcFile, 1); 
 
      // Do something with the floating point image data 
      codecs.save(image, srcFile, RasterImageFormat.PNG, 0); 
 
      assertTrue("file unsuccessfully saved to " + srcFile, (new File(srcFile)).exists()); 
      System.out.printf("File saved successfully to %s%n", srcFile); 
 
      image.dispose(); 
   }  
   else  
      System.out.println("The source file does not have floating point image data"); 
 
   codecs.dispose(); 
} 
Requirements

Target Platforms

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

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