1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

Fixing photo orientation for rotated photos

This commit is contained in:
Patrik J. Braun 2023-09-10 16:59:45 +02:00
parent 009246707f
commit 7ec6725c59

View File

@ -144,6 +144,7 @@ export class ImageRendererFactory {
const svg_buffer = Buffer.from((input as SvgRendererInput).svgString); const svg_buffer = Buffer.from((input as SvgRendererInput).svgString);
image = sharp(svg_buffer, { density: 450 }); image = sharp(svg_buffer, { density: 450 });
} }
image.rotate();
const metadata: Metadata = await image.metadata(); const metadata: Metadata = await image.metadata();
const kernel = const kernel =
input.useLanczos3 === true input.useLanczos3 === true
@ -171,14 +172,14 @@ export class ImageRendererFactory {
}); });
} }
if ((input as MediaRendererInput).mediaPath) { if ((input as MediaRendererInput).mediaPath) {
await image.rotate().webp({ await image.webp({
effort: 6, effort: 6,
quality: input.quality, quality: input.quality,
smartSubsample: (input as MediaRendererInput).smartSubsample smartSubsample: (input as MediaRendererInput).smartSubsample
}).toFile(input.outPath); }).toFile(input.outPath);
} else { } else {
if ((input as SvgRendererInput).svgString) { if ((input as SvgRendererInput).svgString) {
await image.rotate().png({effort: 6, quality: input.quality}).toFile(input.outPath); await image.png({effort: 6, quality: input.quality}).toFile(input.outPath);
} }
} }