Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
capture screen and manupulation with FreeImage.dll
#1
Code:
Copy      Help
 
function str'fileName

opt err 1

LoadFreeImageDLL
#compile "__FreeImage"

FiBitmap x, xG
__GdiHandle hb
str getS setS ST1 fileName2

if(empty(fileName)) fileName = "c:\test.bmp"
fileName2 = fileName

CaptureImageOnScreen 1 1 1119 680 fileName;err ret

getS.getfile(fileName)
x.LoadMem(FIMG.FIF_BMP getS)
xG.Attach(FIMG.FreeImage_ColorQuantizeEx(x,0,16,0,0))

fileName.findreplace(".bmp")
ST1.format("%s.jpg" fileName)
xG.SaveMem(FIMG.FIF_PNG setS)
setS.setfile(ST1)
del- fileName2
ret

Hello ~ Gintaras~ and everyone !!

I tried to get screen capture to BMP image and manipulate to lower colors & size, save to JPG and succeeded.

but I wonder how I could this without saving BMP image first.

Thanks in advance !!!
#2
i don't have free image but from a quick look could probably do something like this
instead of saving the file get the bitmap handle  from CaptureImageOnScreen
Code:
Copy      Help
FiBitmap x xG
__GdiHandle hb
CaptureImageOnScreen 1 1 1119 680 "" hb;err ret
x.FromHBITMAP(hb)
xG.Attach(FIMG.FreeImage_ColorQuantizeEx(x,0,16,0,0))
#3
Kevin, Thanks ! but I tried as you said and it didn't work.
#4
Try this:
Code:
Copy      Help
function str'fileName

opt err 1
#compile "__FreeImage"
FI_ShowMoreErrorInfo
FiBitmap x y
__GdiHandle hb
if(empty(fileName)) fileName = "c:\test.jpg"
CaptureImageOnScreen 1 1 1119 680 "" hb;err ret
x.FromHBITMAP(hb)
y.Attach(FIMG.FreeImage_ColorQuantizeEx(x,0,16,0,0))
y.Save(FIMG.FIF_JPEG fileName)
#5
Start_Learning  Thank you! this works !!!


Forum Jump:


Users browsing this thread: 1 Guest(s)