Jump to content
Sign in to follow this  
vaibhavs

Convert webcam BMP to JPG

Recommended Posts

vaibhavs

Hi,

I am working on the Webcam snapshot AU3.

I am able to capture the photo in bmp.

Any way to convert it into JPG OR grab a picture in JPG format.

As a temporary solution I have found this free command line converter which converts it "bmptojpg.exe".

Please help!.

Thank you.

Vai

Share this post


Link to post
Share on other sites
SadBunny

Hi,

I am working on the Webcam snapshot AU3.

I am able to capture the photo in bmp.

Any way to convert it into JPG OR grab a picture in JPG format.

As a temporary solution I have found this free command line converter which converts it "bmptojpg.exe".

Please help!.

Thank you.

Vai

I guess the temporary option is the best one you have. Short of writing your own jpg to bmp conversion utility, which you don't want to do in autoit because of speed. Still you would have to either use other people's routines (check for open source image converter programs like there are for Linux if you want to do that) or write your own conversion routines which is hard work that's also already been done.

So if it's not your life mission to improve worldwide picture handling, I think you are way better off using something like your freeware app... :)


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Gif

call a .dll

DllCall($dlldir & "\capture.dll", "int:cdecl", "capturewebcam", "str", $defaultdir & "\Full" & $pic & ".jpg", "int")

Share this post


Link to post
Share on other sites
PaulIA

I recommend external commandline tol too. For example IrfanView.

Also Auto3Lib has capture functions also for JPEGs.

It also can convert to/from BMP, GIF, JPG, PNG and TIF.

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
vaibhavs

Thanks for all the inputs.

To summarize, there are 3 options (a) Freeware tool (2) dll Call (3) AutoIT3 Library

I would like to avoid (1) Freeware Tool. The idea is to avoid having to carry an additional file.

Its best if 1 au3 file can handle it all.

C4NM7: can you help me with your dll call.

I am using this script: http://www.autoitscript.com/forum/index.ph...5&hl=webcam from rysiora.

Can you suggest where should I insert the line suggested by you.

I have installed the Library and will post the feedback on using the library.

Thank you.

Vai

Share this post


Link to post
Share on other sites
PaulIA

Thanks for all the inputs.

To summarize, there are 3 options (a) Freeware tool (2) dll Call (3) AutoIT3 Library

I would like to avoid (1) Freeware Tool. The idea is to avoid having to carry an additional file.

Its best if 1 au3 file can handle it all.

C4NM7: can you help me with your dll call.

I am using this script: http://www.autoitscript.com/forum/index.ph...5&hl=webcam from rysiora.

Can you suggest where should I insert the line suggested by you.

I have installed the Library and will post the feedback on using the library.

Thank you.

Vai

Here's a little ditty that converts a BMP to JPG using Auto3Lib:

#include <A3LGDIPlus.au3>

Global $sImage, $hImage, $sCLSID

; Get BMP file to convert
$sImage = InputBox("BMP to JPG", "Enter File Name:", "C:\Image.bmp", "", 200, 130)
if @Error then Exit

; Initialize GDI+ library
_GDI_StartUp()

; Load image
$hImage = _GDI_LoadFromFile($sImage)

; Get JPEG encoder CLSID
$sCLSID = _GDI_GetEncoderClsID("JPG")

; Save image as JPG
_GDI_SaveToFile($hImage, "C:\Image.jpg", $sCLSID)

; Shut down GDI+ library
_GDI_ShutDown()

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
vaibhavs

Hi,

Any idea from where can I get capture.dll ?

Thx

Vai

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×