Skip to content

Commit 089aac6

Browse files
committed
imgcodecs: fix 4 reading channel bmp images
1 parent a9effee commit 089aac6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/imgcodecs/src/grfmt_bmp.cpp

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

482482
if( !color )
483483
icvCvt_BGRA2Gray_8u_C4C1R( src, 0, data, 0, cvSize(m_width,1) );
484-
else
485-
icvCvt_BGRA2BGR_8u_C4C3R( src, 0, data, 0, cvSize(m_width,1) );
484+
else if( img.channels() == 3 )
485+
icvCvt_BGRA2BGR_8u_C4C3R(src, 0, data, 0, cvSize(m_width, 1));
486+
else if( img.channels() == 4 )
487+
memcpy(data, src, m_width * 4);
486488
}
487489
result = true;
488490
break;

0 commit comments

Comments
 (0)