1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

feat(server): keep only essential exif in fullsize preview

This commit is contained in:
Eli Gao 2024-12-18 02:10:55 +08:00
parent f01561e1f1
commit cf0c336c1e
2 changed files with 6 additions and 3 deletions

View file

@ -139,7 +139,7 @@ export interface VideoInterfaces {
export interface IMediaRepository {
// image
extract(input: string, output: string, withExif?: boolean): Promise<boolean>;
writeExif(tags: ExifEntity, output: string): Promise<boolean>;
writeExif(tags: Partial<ExifEntity>, output: string): Promise<boolean>;
decodeImage(input: string, options: DecodeToBufferOptions): Promise<ImageBuffer>;
generateThumbnail(input: string, options: GenerateThumbnailOptions, outputFile: string): Promise<void>;
generateThumbnail(input: Buffer, options: GenerateThumbnailFromBufferOptions, outputFile: string): Promise<void>;

View file

@ -269,8 +269,11 @@ export class MediaService extends BaseService {
// use this as origin of preview and thumbnail
decodeInputPath = extractedPath;
if (asset.exifInfo) {
// write EXIF, especially orientation and colorspace essential for subsequent processing
await this.mediaRepository.writeExif(asset.exifInfo, extractedPath);
// write essential orientation and colorspace EXIF for correct fullsize preview and subsequent processing
await this.mediaRepository.writeExif(
{ orientation: asset.exifInfo.orientation, colorspace: asset.exifInfo.colorspace },
extractedPath,
);
}
} else {
fullsizePath = StorageCore.getImagePath(asset, AssetPathType.FULLSIZE, image.preview.format);