[FlagsAttribute()]
public enum CodecsExtensionListFlags
public enum CodecsExtensionListFlags
[FlagsAttribute()]
public enum class CodecsExtensionListFlags
class CodecsExtensionListFlags(Enum):
None = 0
Stamp = 1
Audio = 2
Value | Member | Description |
---|---|---|
0x00000000 | None | No flags being used. |
0x00000001 | Stamp | A stamp is present. Most likely suitable for LCD displays (and bigger than the stamp stored in the Exif data).The stamp can be loaded with CodecsExtensionList.CreateStamp.Note that this stamp is independent of the regular stamp present in Exif files. Some Exif files have two stamps. The regular stamp is loaded with RasterCodecs.ReadStamp, while the extension stamp is loaded with CodecsExtensionList.CreateStamp. |
0x00000002 | Audio | Embedded audio data is present. The CodecsExtensionList.GetAudioData method can be called to get to the audio data. |
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
public void ExtensionsExample(string exifFileName)
{
RasterCodecs codecs = new RasterCodecs();
string stampFileName = Path.Combine(LEAD_VARS.ImagesDir, "Extension.bmp");
string audioFileNameTemplate = Path.Combine(LEAD_VARS.ImagesDir, "Extension.wav");
// Read the extensions from the file
Debug.WriteLine("Reading the extensions from the exif file");
CodecsExtensionList extensionList = codecs.ReadExtensions(exifFileName, 1);
if (extensionList != null)
{
if ((extensionList.Flags & CodecsExtensionListFlags.Stamp) == CodecsExtensionListFlags.Stamp)
{
Debug.WriteLine("Stamp extension: Found, saving to {0}", stampFileName);
RasterImage stampImage = extensionList.CreateStamp();
codecs.Save(stampImage, stampFileName, RasterImageFormat.Bmp, 24);
stampImage.Dispose();
}
else
Debug.WriteLine("Stamp extension: Not found");
if ((extensionList.Flags & CodecsExtensionListFlags.Audio) == CodecsExtensionListFlags.Audio)
{
Debug.WriteLine("Audio extension: Found, saving ...");
RasterNativeBuffer audioData;
int streamIndex = 0;
do
{
audioData = extensionList.GetAudioData(streamIndex);
if (audioData.Data != IntPtr.Zero)
{
string audioFileName = string.Format(audioFileNameTemplate, streamIndex);
Debug.WriteLine("To {0}", audioFileName);
using (FileStream fs = File.Create(audioFileName))
{
byte[] data = new byte[audioData.Length];
Marshal.Copy(audioData.Data, data, 0, (int)audioData.Length);
fs.Write(data, 0, (int)audioData.Length);
}
streamIndex++;
}
}
while (audioData.Data != IntPtr.Zero);
Debug.WriteLine("{0} total audio streams found", streamIndex);
}
else
Debug.WriteLine("Audio extension: Not found");
CodecsExtension[] extensions = extensionList.GetExtensions();
Debug.WriteLine("Total number of extensions found in the file: {0}", extensions.Length);
for (int i = 0; i < extensions.Length; i++)
{
CodecsExtension extension = extensions[i];
Debug.WriteLine(" {0}. Name: {1}, Clsid: {2}, UCDefault: {3}, DatLength: {4}",
i, extension.Name, extension.Clsid, extension.UCDefault, extension.DataLength);
}
// Finalize cannot be called directly, it is invoked automatically.
// To clean up before exiting, use Dispose
extensionList.Dispose();
}
else
Debug.WriteLine("No extensions were found in the file");
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
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