Audrey Posted June 28, 2011 Share Posted June 28, 2011 (edited) Hi Guys,There are some topics about the writing AVI files with your webcam and screencapture, but I can't find any about converting JPG to AVI.I took a look of this UDF but thats for capturing the screen only.So, I have lets say 10 frames on the desktop, 1.JPG, 2.JPG, 3.JPG, ....They have to be converted to an AVI file and saved to the desktop as well.I changed the code of the link above, but its not working.So I think I missed a extra line in my script to add the right JPG or format.My code:; Example by ProgAndy #include "AVIWriter.au3" Hotkeyset("{ESC}","close") Break(0) Global $count, $hBmp FileDelete(@DesktopDir & "\test.avi") _StartAviLibrary() $avi = _CreateAvi(@DesktopDir & "\test.avi", 5, 340, 240) For $count = 1 to 10 $hBmp = @DesktopDir & "\" & $count & ".jpg" _AddHBitmapToAvi($avi, $hBmp) _WinAPI_DeleteObject($hBmp) Sleep(200) next Func close() _CloseAvi($avi) _StopAviLibrary() exit EndFunc;==>closeCan anyone help me with this?All the best,Audrey Edited June 28, 2011 by Audrey Link to comment Share on other sites More sharing options...
monoscout999 Posted June 28, 2011 Share Posted June 28, 2011 I dont know very well the AVIWriting UDF, but you are passing an String and not a Bitmap handle like the AVIWriting Example... I failed trying to get the hBmp From the jpg files, maybe someone else can help you. Link to comment Share on other sites More sharing options...
Audrey Posted June 28, 2011 Author Share Posted June 28, 2011 (edited) Hi Scout, Thanks for the reply! You are right, my suggestion is wrong. Now I added some GDIplus functions. Maybe this will bring us back on the road... ; Example by ProgAndy #include "AVIWriter.au3" #include <GDIPlus.au3> Hotkeyset("{ESC}","close") Break(0) Global $count, $hBmp FileDelete(@DesktopDir & "\test.avi") _StartAviLibrary() $avi = _CreateAvi(@DesktopDir & "\test.avi", 5, 340, 240) For $count = 1 to 10 $hImage = _GDIPlus_ImageLoadFromFile( @DesktopDir & "\" & $count & ".jpg") $hBmp = _GDIPlus_ImageGetGraphicsContext($hImage) _AddHBitmapToAvi($avi, $hBmp) _WinAPI_DeleteObject($hBmp) Sleep(200) next Func close() _CloseAvi($avi) _StopAviLibrary() exit EndFunc;==>close Greets, Audrey Edited June 28, 2011 by Audrey Link to comment Share on other sites More sharing options...
Armenxxx1 Posted December 24, 2012 Share Posted December 24, 2012 #include "AVIWriter.au3" #include <GDIPlus.au3> Global $count, $hBmp _StartAviLibrary() _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\aaz\1.jpg") $Width = _GDIPlus_ImageGetWidth($hImage) $Height = _GDIPlus_ImageGetHeight($hImage) $avi = _CreateAvi(@DesktopDir & "\test.avi", 5, $Width, $Height) For $count = 1 to 100 $hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\aaz\" & $count & ".jpg") $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _AddHBitmapToAvi($avi, $hBmp) _WinAPI_DeleteObject($hBmp) Sleep(100) next _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBmp) _GDIPlus_Shutdown() _CloseAvi($avi) _StopAviLibrary() exit ravkr 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now