1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Fix saving to JPEG when using linear colorspace

This commit is contained in:
DarthSim 2023-07-02 22:58:32 +03:00
parent 2459741218
commit 136a5d093f
3 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,8 @@
# Changelog
## [Unreleased]
### Fix
- Fix saving to JPEG when using linear colorspace.
## [3.18.1] - 2023-07-29
### Change

View File

@ -9,6 +9,12 @@ import (
func exportColorProfile(pctx *pipelineContext, img *vips.Image, po *options.ProcessingOptions, imgdata *imagedata.ImageData) error {
keepProfile := !po.StripColorProfile && po.Format.SupportsColourProfile()
if img.IsLinear() {
if err := img.RgbColourspace(); err != nil {
return err
}
}
if pctx.iccImported {
if keepProfile {
// We imported ICC profile and want to keep it,

View File

@ -638,6 +638,10 @@ func (img *Image) IsRGB() bool {
format == C.VIPS_INTERPRETATION_RGB16
}
func (img *Image) IsLinear() bool {
return C.vips_image_guess_interpretation(img.VipsImage) == C.VIPS_INTERPRETATION_scRGB
}
func (img *Image) ImportColourProfile() error {
var tmp *C.VipsImage