[bug #68044] Typo in "__magick_read__.cc"
"Dmitri A. Sergatskov" <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
URL:
<https://savannah.gnu.org/bugs/?68044>
Summary: Typo in "__magick_read__.cc"
Group: GNU Octave
Submitter: dasergatskov
Submitted: Fri 13 Feb 2026 11:27:47 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Unlocked
Release: stable
Operating System: Any
Fixed Release: None
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 13 Feb 2026 11:27:47 PM UTC By: Dmitri A. Sergatskov <dasergatskov>
See:
https://octave.discourse.group/t/typo-in-magick-read-cc/7338
"__magick_read__.cc" has an obvious typo around line 367
365 const octave_idx_type nPixels = alpha.numel ();
366 for (octave_idx_type pix = 0; pix < nPixels; pix++)
367 alpha_fvec[pix] = 1 - amap_fvec[static_cast<int>
(img_fvec[3])];
368
369 retval(2) = alpha;
The diff:
diff -r 4707e181cf09 libinterp/corefcn/__magick_read__.cc
--- a/libinterp/corefcn/__magick_read__.cc Wed Feb 11 08:41:16 2026
+0100
+++ b/libinterp/corefcn/__magick_read__.cc Fri Feb 13 18:10:04 2026
-0500
@@ -364,7 +364,7 @@
// 1 for transparent and 0 for opaque so we fix that here.
const octave_idx_type nPixels = alpha.numel ();
for (octave_idx_type pix = 0; pix < nPixels; pix++)
- alpha_fvec[pix] = 1 - amap_fvec[static_cast<int>
(img_fvec[3])];
+ alpha_fvec[pix] = 1 - amap_fvec[static_cast<int>
(img_fvec[pix])];
retval(2) = alpha;
}
fixes that for me. That can be verified by using attached GIF
(file test16.gif) GIF seems to be the only format affected by that.
With original Octave:
octave:1> [im, map, alpha] = imread ("test16.gif")
im =
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
...
alpha =
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
...
incorrectly shows uniform opacity.
With patched
octave:2> [im, map, alpha] = imread ("test16.gif")
im =
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
...
alpha =
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1
...
is correct. That can also be verified by extracting alpha channel by
GraphicsMagick
gm convert test16.gif -channel Opacity -depth 16 gray:alpha_gm.raw
(file alpha_gm.raw)
and inspect the result with e.g. "od -o alpha_gm.raw"
$ od -o alpha_gm.raw
0000000 000000 000000 000000 000000 000000 177777 000000 000000
0000020 000000 000000 000000 000000 000000 000000 000000 000000
0000040 000000 000000 000000 000000 000000 177777 000000 000000
0000060 000000 000000 000000 000000 000000 000000 000000 000000
0000100 000000 000000 000000 000000 000000 177777 000000 000000
...
Dmitri.
--
_______________________________________________________
File Attachments:
Name: test16.gif Size: 179B
<https://file.savannah.gnu.org/file/test16.gif?file_id=58238>
Name: alpha_gm.raw Size: 512B
<https://file.savannah.gnu.org/file/alpha_gm.raw?file_id=58239>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-9953bb12daa795c366b6ab4c67b1c25dc9ff6156.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68044>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaY+zdwAKCRCqLAuaBUf3 ThL0AQCj8XTN0Hqxw7aWqCpBMJ4+ZRoCph5LBlGU+EAyJnWvogD+PxuqBJcYEWqq 1PxIoq9h2DNzDjRIZdV1ly534axWKgg= =4iPE -----END PGP SIGNATURE-----