Skip to content

Commit b872d14

Browse files
committed
Merge pull request opencv#9757 from berak:imgcodecs_4chan_bmp
2 parents a9effee + 089aac6 commit b872d14

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)