mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-07 19:59:07 +00:00
feat(server): wide gamut thumbnails (#3658)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Colorspace } from '@app/infra/entities';
|
||||
import {
|
||||
assetStub,
|
||||
faceStub,
|
||||
@@ -115,7 +116,6 @@ describe(FacialRecognitionService.name, () => {
|
||||
personMock = newPersonRepositoryMock();
|
||||
searchMock = newSearchRepositoryMock();
|
||||
storageMock = newStorageRepositoryMock();
|
||||
configMock = newSystemConfigRepositoryMock();
|
||||
|
||||
mediaMock.crop.mockResolvedValue(croppedFace);
|
||||
|
||||
@@ -292,6 +292,8 @@ describe(FacialRecognitionService.name, () => {
|
||||
expect(mediaMock.resize).toHaveBeenCalledWith(croppedFace, 'upload/thumbs/user-id/person-1.jpeg', {
|
||||
format: 'jpeg',
|
||||
size: 250,
|
||||
quality: 80,
|
||||
colorspace: Colorspace.P3,
|
||||
});
|
||||
expect(personMock.update).toHaveBeenCalledWith({
|
||||
id: 'person-1',
|
||||
@@ -313,6 +315,8 @@ describe(FacialRecognitionService.name, () => {
|
||||
expect(mediaMock.resize).toHaveBeenCalledWith(croppedFace, 'upload/thumbs/user-id/person-1.jpeg', {
|
||||
format: 'jpeg',
|
||||
size: 250,
|
||||
quality: 80,
|
||||
colorspace: Colorspace.P3,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -330,6 +334,8 @@ describe(FacialRecognitionService.name, () => {
|
||||
expect(mediaMock.resize).toHaveBeenCalledWith(croppedFace, 'upload/thumbs/user-id/person-1.jpeg', {
|
||||
format: 'jpeg',
|
||||
size: 250,
|
||||
quality: 80,
|
||||
colorspace: Colorspace.P3,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -162,8 +162,15 @@ export class FacialRecognitionService {
|
||||
height: newHalfSize * 2,
|
||||
};
|
||||
|
||||
const { thumbnail } = await this.configCore.getConfig();
|
||||
const croppedOutput = await this.mediaRepository.crop(asset.resizePath, cropOptions);
|
||||
await this.mediaRepository.resize(croppedOutput, output, { size: FACE_THUMBNAIL_SIZE, format: 'jpeg' });
|
||||
const thumbnailOptions = {
|
||||
format: 'jpeg',
|
||||
size: FACE_THUMBNAIL_SIZE,
|
||||
colorspace: thumbnail.colorspace,
|
||||
quality: thumbnail.quality,
|
||||
} as const;
|
||||
await this.mediaRepository.resize(croppedOutput, output, thumbnailOptions);
|
||||
await this.personRepository.update({ id: personId, thumbnailPath: output });
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user