-
-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example about reading a thumbnail from a raw image.
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Read raw thumbnail | ||
|
||
## Read thumbnail from raw image | ||
|
||
```C# | ||
// Setup DNG read defines | ||
var defines = new DngReadDefines | ||
{ | ||
ReadThumbnail = true | ||
}; | ||
|
||
// Create empty image | ||
using var image = new MagickImage(); | ||
|
||
// Copy the defines to the settings | ||
image.Settings.SetDefines(defines); | ||
|
||
// Read only meta data of the image | ||
image.Ping(SampleFiles.StillLifeCR2); | ||
|
||
// Get thumbnail data | ||
var thumbnailData = image.GetProfile("dng:thumbnail")?.GetData(); | ||
|
||
if (thumbnailData != null) | ||
{ | ||
// Read the thumbnail image | ||
using var thumbnail = new MagickImage(thumbnailData); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using ImageMagick; | ||
using ImageMagick.Formats; | ||
|
||
namespace Magick.NET.Samples; | ||
|
||
public static class ReadRawThumbnailSamples | ||
{ | ||
public static void ReadRawThumbnail() | ||
{ | ||
// Setup DNG read defines | ||
var defines = new DngReadDefines | ||
{ | ||
ReadThumbnail = true | ||
}; | ||
|
||
// Create empty image | ||
using var image = new MagickImage(); | ||
|
||
// Copy the defines to the settings | ||
image.Settings.SetDefines(defines); | ||
|
||
// Read only meta data of the image | ||
image.Ping(SampleFiles.StillLifeCR2); | ||
|
||
// Get thumbnail data | ||
var thumbnailData = image.GetProfile("dng:thumbnail")?.GetData(); | ||
|
||
if (thumbnailData != null) | ||
{ | ||
// Read the thumbnail image | ||
using var thumbnail = new MagickImage(thumbnailData); | ||
} | ||
} | ||
} |