Preparing search index...

    Class FaceImagePickerTextureProvider

    Controls the face image picker texture resource. Can be accessed through Texture.control on a Face Image Picker texture. For more information, see the Face Image Picker Texture guide.

    Use MediaPickerTextureProvider configured to select faces.

    Since Lens Scripting Version 279

    // @input Asset.Texture faceImagePickerTexture

    // Show the face image picker UI
    script.faceImagePickerTexture.control.showImagePicker();

    // Set a callback for when the user picks a different image from the image picker
    script.faceImagePickerTexture.control.setImageChangedCallback(function(){
    print("face image picker image changed");
    });

    Hierarchy (View Summary)

    Index

    Properties

    autoShowImagePicker: boolean

    If enabled, the image picker UI will be shown automatically when the Lens starts.

    Since Lens Scripting Version 279

    autoShowMediaPicker: boolean

    If set to true, MediaPickerTextureProvider will request media picker UI automatically during loading.

    Lens Scripting Version 160

    false
    
    cropFace: boolean

    If set to true, MediaPickerTextureProvider will provide a proper texture transform for image with face(s), that will "zoom" UVs to the first found face on the image.

    Lens Scripting Version 160

    false
    
    cropToFace: boolean

    If enabled, the selected image will be cropped to only show the face region.

    Since Lens Scripting Version 279

    faceControl: FaceTextureProvider

    The FaceTextureProvider used to provide the face texture.

    Since Lens Scripting Version 279

    faceImageControl: FaceTextureProvider

    Returns underlying TextureProvider for the last selected media file. If the last media file was not image with at least one face, null is returned.

    Lens Scripting Version 160

    null
    
    faceRect: vec4

    Use MediaPickerTextureProvider#faceImageControl to access the face area.

    imageControl: TextureProvider

    Returns underlying TextureProvider for the last selected media file. If the last media file was not image, null is returned.

    Lens Scripting Version 160

    isContentReady: boolean

    Returns true if an image is selected, or a video file has been loaded and is ready for decoding, false otherwise.

    isFaceImagePickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select only images with detected faces through media picker UI. See also "cropFace" option.

    false
    
    isImagePickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select all images files through media picker UI.

    true
    
    isVideoPickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select video files through media picker UI.

    true
    
    videoControl: VideoTextureProvider

    Returns underlying VideoTextureProvider for the last selected media file. If the last media file was not video, null is returned.

    Methods

    • Returns a Promise that resolves once this Provider has finished loading its resource.

      Returns Promise<void>

      If the Provider is already loaded when ensureLoaded() is called, the returned Promise resolves immediately. Otherwise it resolves once loading completes.

      Completion is determined by the Provider's load status (see Provider.getLoadStatus). Some Providers only become loaded once supporting runtime data is available — for example, a Provider whose resource depends on tracking will not report loaded until the relevant tracking data has arrived — so the returned Promise stays pending until that data is produced.

      This method is useful when Lens script needs to await a Provider before reading its data — for example, waiting for a remote-asset Provider to finish downloading before sampling it.

      Lens Scripting Version 370

      Fetch a Texture at runtime via RemoteMediaModule and wait for its Provider to finish loading before using it:

      const internetModule = require("LensStudio:InternetModule");
      const remoteMediaModule = require("LensStudio:RemoteMediaModule");

      function loadImageTexture(url) {
      const resource = internetModule.makeResourceFromUrl(url);
      return new Promise((resolve, reject) => {
      remoteMediaModule.loadResourceAsImageTexture(resource, resolve, reject);
      });
      }

      const texture = await loadImageTexture("https://example.com/image.png");

      // Wait until the fetched Texture's Provider has finished loading before using it.
      await texture.control.ensureLoaded();
      print("Texture ready, loadStatus: " + texture.control.getLoadStatus());
    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

      Since Lens Scripting Version 279

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Requests face mesh and sets a callback to fire when it's ready.

      Parameters

      • callback: () => void

      Returns void

      Lens Scripting Version 160

    • Sets a callback to fire when a file is picked through media picking UI.

      Parameters

      • callback: () => void

      Returns void

      Lens Scripting Version 160

    • Binds a callback function for when the user selects or changes an image from the picker.

      Parameters

      • callback: () => void

      Returns void

      Since Lens Scripting Version 279