Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GDI+ - bitmap converting
#1
Hello Gint

Im running code below from a toolbar to capture certain windows.

Macro Macro
Code:
Copy      Help
int hwnd=win
;
RECT r; GetClientRect hwnd &r
POINT p; ClientToScreen hwnd &p

__MemBmp mb
mb.Create(r.right r.bottom 1 p.x p.y)
;
_s="new_img"
if(OpenSaveDialog(1 _s "Image files[]*.bmp[]All Files[]*.*[]" ".bmp"))
,SaveBitmap mb.bm _s
,run _s

I was wondering if we can save the file in other format eg. .jpg by using GDI+ functions?

Only way i could work out so far is create the bitmap file - save bitmap file - convert to jpeg - delete bitmap file.

Can we convert from variable before saving .bmp file or need to save file first?

Thank you.
#2
Searching color from images

The QM GDI+ functions did not have a function to create GDI+ bitmap object from GDI bitmap hanle. You'll find it there.

Macro Macro1814
Code:
Copy      Help
#compile "__Gdip"

int hwnd=win

RECT r; GetClientRect hwnd &r
POINT p; ClientToScreen hwnd &p

__MemBmp mb
mb.Create(r.right r.bottom 1 p.x p.y)

_s="new_img"
if(OpenSaveDialog(1 _s "JPG files[]*.jpg[]All Files[]*.*[]" ".jpg"))
,GdipBitmap im
,if(!im.FromHBITMAP(mb.bm)) end "error"
,if(!im.Save(_s)) end "error"
,run _s
#3
Oh im sorry, i downloaded the updated archive file and found the GDI+ folder in there and i didnt expect other examples on forum.

Thanks.
#4
oh you edited ur post...

Thats exactly what i was looking for. Thanks alot!

Best regards.


Forum Jump:


Users browsing this thread: 3 Guest(s)