feat: warn when losing transparency during thumbnail generation (#26243)

* feat: preserve alpha

* refactor: use isTransparent naming and separate getImageMetadata

* warn instead of preserve
This commit is contained in:
Min Idzelis
2026-02-23 08:16:28 -05:00
committed by GitHub
parent caebe5166a
commit 430638e129
6 changed files with 131 additions and 34 deletions
+3 -3
View File
@@ -309,9 +309,9 @@ export class MediaRepository {
});
}
async getImageDimensions(input: string | Buffer): Promise<ImageDimensions> {
const { width = 0, height = 0 } = await sharp(input).metadata();
return { width, height };
async getImageMetadata(input: string | Buffer): Promise<ImageDimensions & { isTransparent: boolean }> {
const { width = 0, height = 0, hasAlpha = false } = await sharp(input).metadata();
return { width, height, isTransparent: hasAlpha };
}
private configureFfmpegCall(input: string, output: string | Writable, options: TranscodeCommand) {