diff --git a/src/lib/media/manip.ts b/src/lib/media/manip.ts index e8d6564e0..a443569e1 100644 --- a/src/lib/media/manip.ts +++ b/src/lib/media/manip.ts @@ -270,7 +270,7 @@ async function doResize( localUri, [{resize: newDimensions}], { - format: SaveFormat.JPEG, + format: SaveFormat.WEBP, compress: qualityPercentage / 100, }, ) @@ -288,7 +288,7 @@ async function doResize( minQualityPercentage = qualityPercentage newDataUri = { path: normalizePath(resizeRes.uri), - mime: 'image/jpeg', + mime: 'image/webp', size: fileInfo.size, width: resizeRes.width, height: resizeRes.height, diff --git a/src/lib/media/manip.web.ts b/src/lib/media/manip.web.ts index 0686a0702..02a9638bd 100644 --- a/src/lib/media/manip.web.ts +++ b/src/lib/media/manip.web.ts @@ -118,7 +118,7 @@ async function doResize( } return { path: newDataUri, - mime: 'image/jpeg', + mime: 'image/webp', size: getDataUriSize(newDataUri), width: opts.width, height: opts.height, @@ -161,7 +161,7 @@ function createResizedImage( canvas.height = h ctx.drawImage(img, 0, 0, w, h) - resolve(canvas.toDataURL('image/jpeg', quality)) + resolve(canvas.toDataURL('image/webp', quality)) }) img.addEventListener('error', ev => { reject(ev.error) diff --git a/src/lib/media/picker.tsx b/src/lib/media/picker.tsx index c9a52b8ba..6fdfe5438 100644 --- a/src/lib/media/picker.tsx +++ b/src/lib/media/picker.tsx @@ -25,7 +25,7 @@ export async function openCamera(customOpts: ImagePickerOptions) { return { path: asset.uri, - mime: asset.mimeType ?? 'image/jpeg', + mime: asset.mimeType ?? 'image/webp', size: asset.fileSize ?? 0, width: asset.width, height: asset.height, @@ -37,7 +37,7 @@ export async function openCropper(opts: OpenCropperOptions) { doneButtonText: t`Done`, cancelButtonText: t`Cancel`, ...opts, - format: 'jpeg', + format: 'png', }) return { diff --git a/src/state/gallery.ts b/src/state/gallery.ts index 7dde7bbec..a8955c324 100644 --- a/src/state/gallery.ts +++ b/src/state/gallery.ts @@ -247,7 +247,7 @@ export async function compressImage( [{resize: {width: w, height: h}}], { compress: qualityPercentage / 100, - format: SaveFormat.JPEG, + format: SaveFormat.WEBP, base64: true, }, ) @@ -260,7 +260,7 @@ export async function compressImage( path: await moveIfNecessary(res.uri), width: res.width, height: res.height, - mime: 'image/jpeg', + mime: 'image/webp', size, } } else {