mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
removing metadata from webp #558
This commit is contained in:
parent
70d1a04e1b
commit
e6774bf689
@ -100,7 +100,8 @@ export class PhotoProcessing {
|
||||
width: person.sampleRegion.box.width + margin.x,
|
||||
height: person.sampleRegion.box.height + margin.y,
|
||||
},
|
||||
qualityPriority: Config.Server.Media.Thumbnail.qualityPriority,
|
||||
useLanczos3: Config.Server.Media.Thumbnail.useLanczos3,
|
||||
quality: Config.Server.Media.Thumbnail.quality,
|
||||
} as RendererInput;
|
||||
input.cut.width = Math.min(
|
||||
input.cut.width,
|
||||
@ -121,7 +122,7 @@ export class PhotoProcessing {
|
||||
return path.join(
|
||||
ProjectPath.TranscodedFolder,
|
||||
ProjectPath.getRelativePathToImages(path.dirname(mediaPath)),
|
||||
file + '_' + size + '.webp'
|
||||
file + '_' + size + 'q' + Config.Server.Media.Thumbnail.quality + '.webp'
|
||||
);
|
||||
}
|
||||
|
||||
@ -235,7 +236,8 @@ export class PhotoProcessing {
|
||||
size,
|
||||
outPath,
|
||||
makeSquare,
|
||||
qualityPriority: Config.Server.Media.Thumbnail.qualityPriority,
|
||||
useLanczos3: Config.Server.Media.Thumbnail.useLanczos3,
|
||||
quality: Config.Server.Media.Thumbnail.quality,
|
||||
} as RendererInput;
|
||||
|
||||
const outDir = path.dirname(input.outPath);
|
||||
|
@ -44,7 +44,8 @@ export interface RendererInput {
|
||||
size: number;
|
||||
makeSquare: boolean;
|
||||
outPath: string;
|
||||
qualityPriority: boolean;
|
||||
quality: number;
|
||||
useLanczos3: boolean;
|
||||
cut?: {
|
||||
left: number;
|
||||
top: number;
|
||||
@ -137,7 +138,7 @@ export class ImageRendererFactory {
|
||||
const metadata: Metadata = await image.metadata();
|
||||
|
||||
const kernel =
|
||||
input.qualityPriority === true
|
||||
input.useLanczos3 === true
|
||||
? sharp.kernel.lanczos3
|
||||
: sharp.kernel.nearest;
|
||||
|
||||
@ -161,7 +162,7 @@ export class ImageRendererFactory {
|
||||
fit: 'cover',
|
||||
});
|
||||
}
|
||||
await image.withMetadata().webp({effort: 6, quality: 60}).toFile(input.outPath);
|
||||
await image.webp({effort: 6, quality: input.quality}).toFile(input.outPath);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -142,8 +142,10 @@ export class ServerDataBaseConfig {
|
||||
|
||||
@SubConfigClass()
|
||||
export class ServerThumbnailConfig {
|
||||
@ConfigProperty({description: 'if true, photos will have better quality.'})
|
||||
qualityPriority: boolean = true;
|
||||
@ConfigProperty({description: 'if true, \'lanczos3\' will used to scale photos, otherwise faster but lowe quality \'nearest\'.'})
|
||||
useLanczos3: boolean = true;
|
||||
@ConfigProperty({description: 'Thumbnail image quality', max: 100, min: 1, type: 'unsignedInt'})
|
||||
quality = 80;
|
||||
@ConfigProperty({type: 'ratio'})
|
||||
personFaceMargin: number = 0.6; // in ration [0-1]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user