diff --git a/core/image/common.odin b/core/image/common.odin index e92060ed2..9024ec769 100644 --- a/core/image/common.odin +++ b/core/image/common.odin @@ -150,15 +150,15 @@ return_single_channel :: proc(img: ^Image, channel: Channel) -> (res: ^Image, ok idx := int(channel); - if idx > img.channels { - return {}, false; - } - if img.channels == 2 && idx == 4 { // Alpha requested, which in a two channel image is index 2: G. idx = 2; } + if idx > img.channels { + return {}, false; + } + switch(img.depth) { case 8: buffer_size := compute_buffer_size(img.width, img.height, 1, 8);