I failed again but i resorted to my 2nd option, draw to DC and use that for saving, this may possibly loose the alphablending:
(PwrDev code but you'll get the idea)
Sub GDIP_Clone (ByVal hdc As Dword)
Local hStatus As Long
Local pGraphics As Dword
Local pImage As Dword
Local hBitmap As Dword
Local pData As Long
Local hOldDIB As Long
Local hMemDC As Long
Local hDIB As Long
Local BMI As BITMAPINFO
Local CDW As Dword
Local T As String
Local pStream As Dword Ptr
pImage = VD_GDIPlus_LoadFromFile( "D:\Nieuwe map (3)\346074.jpg" )
If pImage = 0 Then Exit Sub
BMI.bmiHeader.biSize = SizeOf( BMI.bmiHeader )
BMI.bmiHeader.biWidth = 614
BMI.bmiHeader.biHeight = 762
BMI.bmiHeader.biPlanes = 1
BMI.bmiHeader.biBitCount = 24
BMI.bmiHeader.biCompression = %BI_RGB
hMemDC = CreateCompatibleDC( hDC )
hDIB = CreateDIBSection( hDC, BMI, %DIB_RGB_COLORS, pData, 0, 0 )
hOldDIB = SelectObject( hMemDC, hDIB )
pGraphics = VD_GDIPlus_Graphics_CreateFromHDC( hMemDC )
CDW = GetProcAddress( VD_GDIPlus_Props.hLib, "GdipDrawImageRectRectI" )
Call Dword CDW Using VD__GdipDrawImageRectRectI( pGraphics, pImage, 0, 0, 614, 762, 0, 0, 4274, 5304, 2, 0, 0, 0 )
SelectObject( hMemDC, hOldDIB )
hBitmap = VD_GDIPlus_CreateBitmapFromHBITMAP( hDIB, 0 )
pStream = VD_GDIPlus_SaveImageToStream( hBitmap, "image/png" )
If pStream > 0 Then
T = VD_IStream_ReadAllStr( pStream )
VD_SaveToFile( "d:\testimg.png", T )
Call Dword @@pStream[2] Using VD_GDIPlus_CallCom( pStream )
End If
VD_GDIPlus_Graphics_Delete( pGraphics ): pGraphics = 0
DeleteObject( hDIB ): hDIB = 0
DeleteDC( hMemDC ): hMemDC = 0
VD_Debug_Print "FileSize " & Str$( Len( T ) )
End Sub