mirror of
				https://github.com/imgproxy/imgproxy.git
				synced 2025-10-30 23:08:02 +02:00 
			
		
		
		
	Fix trimming of CMYK images
This commit is contained in:
		| @@ -8,6 +8,10 @@ import ( | ||||
| ) | ||||
|  | ||||
| func importColorProfile(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions, imgdata *imagedata.ImageData) error { | ||||
| 	if pctx.iccImported { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	if err := img.Rad2Float(); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -11,6 +11,11 @@ func trim(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions, | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	// We need to import color profile before trim | ||||
| 	if err := importColorProfile(pctx, img, po, imgdata); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	if err := img.Trim(po.Trim.Threshold, po.Trim.Smart, po.Trim.Color, po.Trim.EqualHor, po.Trim.EqualVer); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user