From 8ee825964d3110ebddd534540bae2126248f34df Mon Sep 17 00:00:00 2001
From: Mert <101130780+mertalev@users.noreply.github.com>
Date: Wed, 2 Oct 2024 16:53:17 -0400
Subject: [PATCH] fix(server): thumbnail colorspace handling (#13130)

fix colorspace handling
---
 server/src/repositories/media.repository.ts | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/server/src/repositories/media.repository.ts b/server/src/repositories/media.repository.ts
index cca87f44f2..0777ca3479 100644
--- a/server/src/repositories/media.repository.ts
+++ b/server/src/repositories/media.repository.ts
@@ -79,13 +79,12 @@ export class MediaRepository implements IMediaRepository {
       failOn: options.processInvalidImages ? 'none' : 'error',
       limitInputPixels: false,
       raw: options.raw,
-    });
+    })
+      .pipelineColorspace(options.colorspace === Colorspace.SRGB ? 'srgb' : 'rgb16')
+      .withIccProfile(options.colorspace);
 
     if (!options.raw) {
-      pipeline = pipeline
-        .pipelineColorspace(options.colorspace === Colorspace.SRGB ? 'srgb' : 'rgb16')
-        .withIccProfile(options.colorspace)
-        .rotate();
+      pipeline = pipeline.rotate();
     }
 
     if (options.crop) {