Skip to content

Error -> undefined is not an object (evaluating 'image.ios.image') #2

@360disrupt

Description

@360disrupt

I tried to use the module with two images, 1st I took an image with the camera module and 2nd I loaded an image from the filesystem. Both times I can display the image in my view, and see in my console.log : Image(14) so I assume the image is loaded properly.

Bot times I get the following error:

Error -> undefined is not an object (evaluating 'image.ios.image')

1st with camera:

      camera.takePicture(cameraOptions)
          .then( (imageAsset) => {
              // Using the image from camera
              console.log("imageAsset", imageAsset);
              this.image = new Image();
              this.image.src = imageAsset;
              console.log("imageAsset", imageAsset.nativeImage)
              console.log("IMAGE from CAMERA", this.image)
              const colors = ImageColors.getColorPalette(this.image)
              console.log("FAILS:", colors) // undefined is not an object (evaluating 'image.ios.image')

2nd from file:

              const folder: Folder = <Folder> knownFolders.currentApp();
              const folderPath: string = path.join(folder.path, "assets/images/test.png");
              const imageFromLocalFile: ImageSource = <ImageSource> fromFile(folderPath);
              this.image = new Image();
              this.image.src = imageFromLocalFile;
              console.log("IMAGE from FILE", this.image)
              const colors = ImageColors.getColorPalette(this.image)
              console.log("FAILS:", colors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions