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:
parent
2459741218
commit
136a5d093f
@ -1,6 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
### Fix
|
||||
- Fix saving to JPEG when using linear colorspace.
|
||||
|
||||
## [3.18.1] - 2023-07-29
|
||||
### Change
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user