Compositing or extending a 32-bit magickImage caps the pixel values to 16-bit (65535)
See original GitHub issueMagick.NET version
12.1.0.0
Environment (Operating system, version and so on)
Windows 10 x64 - Visual Studio 2019 v16.11.9
Description
Goal: merge two 32-bit images.
After extending a 32-bit image, all pixel values are capped to a value of 65535. After compositing a 32-bit image, the pixel values of the original image are correct (can be higher than 65535), but the pixel values of the new/added image are also capped at a value of 65535.
Steps to Reproduce
- Download test images added as attachment
- Set path1 and path2 to the location of those images
- Call the functions below:
Example 1: Extent
static void ExtentImage(string path1, string path2)
{
IMagickImage<float> image1 = new MagickImage(path1);
IMagickImage<float> image2 = new MagickImage(path2);
IMagickImage<float> result = new MagickImage(path1);
result.Depth = 32; // already has a depth of 32, but added it just to be sure
var pixels = result.GetPixelsUnsafe().GetValues(); // has pixel values above 65535
result.Extent(image1.Width + image2.Width, image1.Height);
var pixels_extent = result.GetPixelsUnsafe().GetValues(); // pixel values are not higher than 65535
}
Example 2: Composite
static void CompositeImage(string path1, string path2)
{
IMagickImage<float> image1 = new MagickImage(path1);
IMagickImage<float> image2 = new MagickImage(path2);
IMagickImage<float> result = new MagickImage(path1);
result.Depth = 32;
var pixels = result.GetPixelsUnsafe().GetValues(); // has pixel values above 65535
result.Composite(image2, image1.Width/2, 0, CompositeOperator.In);
var pixels_comp = result.GetPixelsUnsafe().GetValues(); // old part of the image still has values above 65535, but new (added) image is capped at 65535
}
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Doesn't the Color Picker work in 16-bit mode?
When I switch Photoshop to 16-bit mode, the color picker seems to stay in 8-bit mode (the values only go up to 255...
Read more >RE: Combining HDR/EXR files into a single PSD
I've been using Magick++ for a system which handles compositing image layers. ... See the example pixel value in the source EXR and...
Read more >32bit exr file has incorrect bitdepth of 16. · Issue #479
I have a 32bit exr file with values [0-1]. ... I set it to TrueColorAlpha again the pixel values in the 32bit tiff...
Read more >GraphicsMagick GM Utility
Name Mode Description
3FR r‑‑ Hasselblad Photo RAW
8BIM rw‑ Photoshop resource format
8BIMTEXT rw‑ Photoshop resource text format
Read more >composite(1) — graphicsmagick-imagemagick-compat
Raw images are expected to have one byte per pixel unless gm is compiled in 16-bit quantum mode or in 32-bit quantum mode....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In the next release clamping will be disabled by default when extending an image.
Works like a charm, thanks a lot Dirk! Personally would disable the clamping for HDRI by default. It’s a bit confusing that this happens automatically.