wia image format

Hi all,

I have the following jscript code to acquire images from a camera in ie7. It works fine but stores images in bmp format. Can anyone tell me how to get it to store jpeg format changing the filename in MyPic.Transfer to ".jpg" doesn't do the trick. It will just save Nothing!

thanx in advance

objWia = new ActiveXObject("Wia.Script");
MyDevice = objWia.Create(null);
AllPics = MyDevice.GetItemsFromUI(0,0);
MyPic = AllPics(0);
MyPic.Transfer("pic.bmp",false);
delete objWia;



Answer this question

wia image format

  • Mr_White

    Thanks...

    I 've searched a lot before I posted my question here and found a lot of examples in vb and vc but none on a scripting language.

    Does anybody know of any other way to get a picture from a camera in IE and store it in jpeg


  • JOshLewis

    I messed with some WIA stuff before. Here is a good vb reference but I'm not sure how you would implement it in Javascript

    Item item = device.Execute
    Dim item As Item = device.ExecuteCommand(CommandID.wiaCommandTakePicture)
    For Each format As String In item.Formats
    If (format = jpegGuid) Then
    Dim imagefile As WIA.ImageFile = CType(item.Transfer(format),WIA.ImageFile)
    filename = GetFreeFileName
    If (String.IsNullOrEmpty(filename) = false) Then
    imagefile.SaveFile(filename)
    End If
    Me.picLastImage.Load(filename)
    Return filename
    End If
    Next

    http://msdn.microsoft.com/coding4fun/hardware/video/article.aspx articleid=912546


  • wia image format