In the SetDIBitsToDevice API function,

Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal hdc As Long, ByVal XDest As Long, ByVal yDest As Long, ByVal dx As Long, ByVal dy As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BITMAPINFO, ByVal wUsage As Long) As Long

xDest, yDest are the coordinates of the upper left corner of the destination rectangle whereas
xSrc, ySrc are the coordinates of the lower left corner of the source DIB.

Therefore the original image comes out with the Y axis flipped.

In order to restore the Y orientation, can I give different function parameters or do I have to switch the source rows? I'm using a 2 dimensional souce array.