I am writing an application, it should save the photo in a blob-field, but this will be the next step, and now I want to get a snapshot at least as a .jpg file. But somehow I get .bmp, but I can’t .jpg, I just create a file with 0 (zero) bytes.
Button code save photos from the camera:
procedure TForm1.Button14Click(Sender: TObject); var jpgImg: TJPEGImage; begin hWndC := capCreateCaptureWindowA('My Own Capture Window', WS_CHILD or WS_VISIBLE, Image1.Left, Image1.Top, Image1.Width, Image1.Height, Form1.Handle, 0); if hWndC <> 0 then SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0); //"подключаемся" к веб-камере jpgImg := TJPEGImage.Create; jpgImg.Assign(image1.Picture.Bitmap); jpgImg.SaveToFile(ExtractFilePath(Application.ExeName)+'\tmp_0001.jpg'); jpgImg.Free; SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0); //"отключаемся" от веб-камеры hWndC := 0; end; The uses JPEG connected.
What could be wrong?
jpgImg.Assign(image1.Picture.Bitmap);Well, where in the Image1.Picture.Bitmap itself is something written? - kamijpgImg.Assign(image1.Picture.Bitmap)- I_CaR