ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Video functions
  • Saving a photo
  • Use conditions:
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Captures the images received from the camera:
  • as an image: takes a photo.
  • as a video: records a video.
Depending on the platform, the following photo and video formats are used:
  • WINDEVWindows BMP images or AVI videos.
    If the file extension is .jpg or .jpeg, the image is saved in JPEG format
Example
WINDEVUser code (UMC)
// Enregistre la vidéo retransmise dans le champ Caméra "CAM_Cuisine"
// sous forme d'une AVI ("C:\Temp\MaVideo.AVI") de 1 minute
ResSauvegarde = VidéoCapture(CAM_Cuisine, "C:\Temp\MaVideo.AVI", viVideoCapture, 60)
IF ResSauvegarde = True THEN
Info("Vidéo correctement sauvegardée")
ELSE
Error(ErrorInfo())
END
Syntax
<Result> = VideoCapture(<Camera control> , <File to create> [, <Type of capture> [, <Capture duration> [, <Number of images per second> [, <Preview stream>]]]])
<Result>: Boolean
  • True if the video was recorded successfully,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Camera control>: Control name
Name of the Camera control to be used. There is no need to display the video in a Camera control to save it.
<File to create>: Character string
Name and full (or relative) path of the file to create.
WINDEVWindows When a photo is taken, a BMP file is created. When a video is recorded, an AVI file is created
Warning: No UNC path can be used.
<Type of capture>: Optional integer constant
Type of capture:
viPictureCapture
WINDEVWindows Captures an image and saves it as a BMP file.

viVideoCapture
(Default value)
WINDEVWindows Captures a video and saves it as an AVI file.

<Capture duration>: Optional integer
Length of the video recording (in seconds). If this parameter is set to 0 or is not specified, the video recording will stop:
  • when VideoStop is called.
  • when there is no more space on the disk.
This parameter can be:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
<Number of images per second>: Optional integer
Number of images frames per second (15 by default). This parameter is taken into account only if <Type of capture> is equal to viVideoCapture.
<Preview stream>: Optional boolean
  • True (by default) if the video stream must be displayed in the specified Camera control,
  • False otherwise.
Remarks

Saving a photo

Only the image displayed when VideoCapture is executed is saved as a BMP image. To save this image, you can also use:
  • the dSaveImageBMP function: the photo will be saved as a BMP file.
  • the dSaveImageGIF function: the photo will be saved as a GIF file.
  • the dSaveImageJPEG function: the photo will be saved as a JPEG file.

Use conditions:

  • WINDEVWindows To use this function, a "web camera" must be connected to the current computer.
Remark: This function is equivalent to CameraCapture.
Related Examples:
The Camera functions Unit examples (WINDEV Mobile): The Camera functions
[ + ] Using the WLanguage "Camera" functions to start the native video camera application of the device in order to record a video or to take a photo.
WM System Cross-platform examples (WINDEV Mobile): WM System
[ + ] This application is an example of some of the features of WINDEV Mobile available for Android/iOS.
The following system functions are used:
- NFC
- Multimedia control
- Brightness
- Volume
- Wi-Fi
- Bluetooth
- Toast
- Compass
- Accelerometer
- Camera control
- LED
- Vibration
- Notifications
- Drawing functions
- Internet
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
SALVAR FOTO NO BANCO REDIMENSIONANDO O TAMANHO E AJUSTANDO A QAULIDADE
PROCEDURE PhotoEnregistre()

path_imagem is string = fCurrentDir()+fSep()+"IMAGEM.JPG" // ONDE VAI SALVAR A IMAGEM

//VideoParameter(vipPhotoResolution,"1080 1080")

VideoCapture(CAM_Appareil,path_imagem,viPictureCapture) // TIROU A FOTO

IMAGEM is Image // IMAGEM DE TRABALHO PARA REDIMENSIONAR O BUFFER EM OUTRO TAMANHO

IMAGEM = fLoadBuffer(path_imagem)

IF fFileExist(path_imagem) = True THEN //DEU CERTO
Info("A Imagem "+path_imagem+" Existe no disco")
dResize(IMAGEM,320,480,drStretched) //RESIZE DA IMAGEM
dSaveImageJPEG(IMAGEM,path_imagem,80) //80%
ELSE
Info("A Imagem "+path_imagem+" nao existe no disco") //DEU ERRADO
RETURN
END

T001_FOTOS.T001_DATA_HORA = DateSys() + TimeSys()

T001_FOTOS.T001_FOTO = fLoadBuffer(path_imagem) //BUFFER MODIFICADO E SALVO NO BINARIO

IF HAdd(T001_FOTOS)=True THEN
ShellExecute(path_imagem) //GRAVOU NO BANCO E ABRIU A IMAGEM
END
Boller
23 Mar. 2023

Last update: 06/23/2023

Send a report | Local help