[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #41584] .bmp / .png display error for saturate
From: |
Valery |
Subject: |
[Octave-bug-tracker] [bug #41584] .bmp / .png display error for saturated RGB image. |
Date: |
Fri, 10 Jul 2015 11:41:24 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 |
Follow-up Comment #5, bug #41584 (project octave):
Hi,
the problem shows up to me when using the following images:
PNG 1250x1250 1250x1250+0+0 8-bit sRGB 250KB 0.000u 0:00.000
in which:
[...]
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 1-bit
green: 8-bit
blue: 8-bit
[...]
So the "unlucky" red channel causes get_depth currently to override the
correct default result value "8" with the incorrect "1", what then leads to
the false matrix type "logical".
As quick-n-dirty fix I added these two lines with conditions for the green and
blue channels:
libinterp/dldfcn/__magick_read__.cc
static octave_idx_type
get_depth (Magick::Image& img)
{
octave_idx_type depth = img.depth ();
if (depth == 8
&& img.channelDepth (Magick::RedChannel) == 1
&& img.channelDepth (Magick::GreenChannel) == 1 // <<--- added
&& img.channelDepth (Magick::BlueChannel) == 1 // <<--- added
&& img.channelDepth (Magick::CyanChannel) == 1
&& img.channelDepth (Magick::OpacityChannel) == 1
&& img.channelDepth (Magick::GrayChannel) == 1)
depth = 1;
return depth;
}
and am getting uint8 for the image matrix in result.
Now I am bound to this my fixed Octave version and would be cool if this or
other patch could be incorporated in next public releases.
P.S. Disclaimer: I don't have an answer though, why Cyan, Opacity and Gray
channels all return depth of 1 for such images .
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?41584>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #41584] .bmp / .png display error for saturated RGB image.,
Valery <=