snapshot: fix vips rgba/gray ops

This commit is contained in:
Koushik Dutta
2023-12-11 09:28:24 -08:00
parent 05b206f897
commit 9d4f006caa
3 changed files with 11 additions and 3 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.13",
"version": "0.2.14",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/snapshot",
"version": "0.2.13",
"version": "0.2.14",
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",
"@types/node": "^18.16.18",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.13",
"version": "0.2.14",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",

View File

@@ -71,6 +71,12 @@ export class VipsImage implements Image {
if (options?.format === 'rgb') {
transformed.removeAlpha().toFormat('raw');
}
else if (options?.format === 'rgba') {
transformed.ensureAlpha().toFormat('raw');
}
else if (options?.format === 'gray') {
transformed.toFormat('raw').grayscale();
}
else if (options?.format === 'jpg') {
transformed.toFormat('jpg');
}
@@ -106,6 +112,8 @@ export class VipsImage implements Image {
}
export async function loadVipsImage(data: Buffer | string, sourceId: string) {
loadSharp();
const image = sharpInstance(data, {
failOnError: false,
});