1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-11-27 22:48:53 +02:00

Fix handling ICC profiles with vips 8.15+

This commit is contained in:
DarthSim
2024-12-17 21:44:12 +03:00
parent 301ca08236
commit edb050ed21
6 changed files with 88 additions and 3 deletions

View File

@@ -736,6 +736,26 @@ func (img *Image) IsLinear() bool {
return C.vips_image_guess_interpretation(img.VipsImage) == C.VIPS_INTERPRETATION_scRGB
}
func (img *Image) BackupColourProfile() {
var tmp *C.VipsImage
if C.vips_icc_backup(img.VipsImage, &tmp) == 0 {
C.swap_and_clear(&img.VipsImage, tmp)
} else {
log.Warningf("Can't backup ICC profile: %s", Error())
}
}
func (img *Image) RestoreColourProfile() {
var tmp *C.VipsImage
if C.vips_icc_restore(img.VipsImage, &tmp) == 0 {
C.swap_and_clear(&img.VipsImage, tmp)
} else {
log.Warningf("Can't restore ICC profile: %s", Error())
}
}
func (img *Image) ImportColourProfile() error {
var tmp *C.VipsImage