Camera.getPhoto quality option ignored, png == jpeg?


I would like to reduce the filesize of taken photos, but changing the quality option doesnt have an effect. The file size is always nearly the same, depending on the light condition. For testing I m using a webcam on a tripod. And after uploading a photo on my linux server, the command “file” for checking the file type shows “PNG image data …” (?).

Code snippet from the Photo-Gallery example

const capturedPhoto = await Camera.getPhoto({
      resultType: CameraResultType.Uri,
      source: CameraSource.Camera,
      quality: 20,
      allowEditing: false

Is this an expected result? But the documentation says for “quality”: The quality of image to return as JPEG, from 0-100.

are you running on web, iOS or Android?

In the moment running on web

web implementation doesn’t support some of the options yet

Hm, the docu says:

“The format of the image, ex: jpeg, png, gif. iOS and Android only support jpeg. Web supports jpeg and png. gif is only supported if using file input.”

Ok then, but is there maybe a good package for manipulating photos or creating thumbnails?

I thought I could create a thumbnail with image-thumbnail, but this seems to work only on server-side with node.js. It would have been perfect, taking a photo and saving just a 200x200 px centre cover from the original photo, forced to jpeg.

The option line would have been for my case:

    const imageThumbnail = require('image-thumbnail');
    const base64_data = await this.readAsBase64(photo);
    let options = { width: 200, height: 200, responseType: 'base64', jpegOptions: { force:true, quality:60 } };
    try {
      const thumbnail_data = await imageThumbnail(base64_data, options);

Now I looking for something simular. Any package recommendation for this?

As long as there is no other solution, I do it all in php with Imagick. resize, crop and png to jpeg. A picture that has e.g. a size of 500 KB has in the end only about 20 KB in jpeg format. Picture used for profile image and avatar.