mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(server): optimize person thumbnail generation (#7513)
* do crop and resize together * redundant `pipelineColorspace` call * formatting * fix rebase * handle orientation * remove unused import * formatting * use oriented dimensions for half size calculation * default case for orientation * simplify orientation code --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
81e4b69caf
commit
1167f0f2b7
8 changed files with 137 additions and 105 deletions
|
|
@ -3,11 +3,19 @@ import { ImageFormat, TranscodeTarget, VideoCodec } from 'src/entities/system-co
|
|||
|
||||
export const IMediaRepository = 'IMediaRepository';
|
||||
|
||||
export interface ResizeOptions {
|
||||
export interface CropOptions {
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface ThumbnailOptions {
|
||||
size: number;
|
||||
format: ImageFormat;
|
||||
colorspace: string;
|
||||
quality: number;
|
||||
crop?: CropOptions;
|
||||
}
|
||||
|
||||
export interface VideoStreamInfo {
|
||||
|
|
@ -45,13 +53,6 @@ export interface VideoInfo {
|
|||
audioStreams: AudioStreamInfo[];
|
||||
}
|
||||
|
||||
export interface CropOptions {
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface TranscodeOptions {
|
||||
inputOptions: string[];
|
||||
outputOptions: string[];
|
||||
|
|
@ -76,8 +77,7 @@ export interface VideoCodecHWConfig extends VideoCodecSWConfig {
|
|||
export interface IMediaRepository {
|
||||
// image
|
||||
extract(input: string, output: string): Promise<boolean>;
|
||||
resize(input: string | Buffer, output: string, options: ResizeOptions): Promise<void>;
|
||||
crop(input: string, options: CropOptions): Promise<Buffer>;
|
||||
generateThumbnail(input: string | Buffer, output: string, options: ThumbnailOptions): Promise<void>;
|
||||
generateThumbhash(imagePath: string): Promise<Buffer>;
|
||||
getImageDimensions(input: string): Promise<ImageDimensions>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue