Fix colors for PSDs (#1449)

* Fix colors for PSDs

`HydrusImageHandling.DequantizeNumPyImage` should only be applied to images that are BGR (eg those directly from opencv). PIL produces RGB images already so this was inverting the colors on PSD thumbnails. Instead we use `HydrusImageHandling.DequantizePILImage` to handle edge cases.

* Dequantize the PSD PIL image before resizing
This commit is contained in:
Paul Friederichsen 2023-09-30 13:36:15 -05:00 committed by GitHub
parent b4afedb617
commit 59b01d7106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -44,14 +44,13 @@ def GenerateThumbnailNumPyFromPSDPath( path: str, target_resolution: typing.Tupl
if clip_rect is not None:
pil_image = HydrusImageHandling.ClipPILImage( pil_image, clip_rect )
pil_image = HydrusImageHandling.DequantizePILImage( pil_image )
thumbnail_pil_image = pil_image.resize( target_resolution, PILImage.LANCZOS )
numpy_image = HydrusImageHandling.GenerateNumPyImageFromPILImage(thumbnail_pil_image)
numpy_image = HydrusImageHandling.DequantizeNumPyImage( numpy_image )
return numpy_image