public bool IsFloat { get; }
@property (nonatomic, assign, readonly) BOOL IsFloat;
public boolean IsFloat()
public:
property bool IsFloat {
bool get();
}
IsFloat # get (CodecsImageInfo)
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.
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();
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.