Skip to content

Commit 14b686c

Browse files
berakalalek
authored andcommitted
imgcodecs: fix 4 reading channel bmp images
1 parent 0202e52 commit 14b686c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/highgui/src/grfmt_bmp.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,10 @@ decode_rle8_bad: ;
473473

474474
if( !color )
475475
icvCvt_BGRA2Gray_8u_C4C1R( src, 0, data, 0, cvSize(m_width,1) );
476-
else
477-
icvCvt_BGRA2BGR_8u_C4C3R( src, 0, data, 0, cvSize(m_width,1) );
476+
else if( img.channels() == 3 )
477+
icvCvt_BGRA2BGR_8u_C4C3R(src, 0, data, 0, cvSize(m_width, 1));
478+
else if( img.channels() == 4 )
479+
memcpy(data, src, m_width * 4);
478480
}
479481
result = true;
480482
break;

0 commit comments

Comments
 (0)