davidbyttow / govips

A lightning fast image processing and resizing library for Go
MIT License
1.27k stars 200 forks source link

CMYK image colour changes post image resize #275

Open vaidhyanathan-ananthakrishnan-13 opened 2 years ago

vaidhyanathan-ananthakrishnan-13 commented 2 years ago

The version used: v2.7.0

For a set of images, If I resize the image using the govips , the CMYK file's color is changing drastically, but for the same image when I tried using the libvips command line, it is working fine.

Original image: https://raw.githubusercontent.com/vaidhyanathan93/Todo/master/5000.jpg Resized image : https://raw.githubusercontent.com/vaidhyanathan93/Todo/master/Resized.webp

Lib vips command line

vipsthumbnail 5000-1.jpeg -s 540x439

sbraty commented 2 years ago

Before transform image call function OptimizeICCProfile()

img, err := vips.NewImageFromReader(reader)
if err != nil {...}
if err := img.OptimizeICCProfile(); err != nil {...}
vaidhyanathan-ananthakrishnan-13 commented 2 years ago

Tried with OptimizeICCProfile but got the error below

Screenshot 2022-04-01 at 2 55 11 PM
sbraty commented 2 years ago

Error, i cant reproduce, but got same problem with colors after transform.

After reading code i found out, this part of code works strange.

Why we should ignore embeded profile if image has it. It's true only for images with CMYK color space

cc @alon-ne

sbraty commented 2 years ago

@Elad-Laufer can you look at comment above. Why did you prevent using embeded color profile at image with CMYK color space ?

vaidhyanathan-ananthakrishnan-13 commented 2 years ago

@sbraty

Is there any workaround for this ?

sbraty commented 2 years ago

@sbraty

Is there any workaround for this ?

im using my own fork