1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-12-24 00:35:32 +02:00

Remove ICC hacks; Enable ICC support for PNG

This commit is contained in:
DarthSim
2021-06-25 13:28:33 +06:00
parent 6f21815fd3
commit 302bf64ea2
6 changed files with 10 additions and 37 deletions

16
vips.go
View File

@@ -578,8 +578,8 @@ func (img *vipsImage) ImportColourProfile() error {
func (img *vipsImage) ExportColourProfile() error {
var tmp *C.VipsImage
// Don't export is there's no embedded profile or embedded profile is sRGB
if C.vips_has_embedded_icc(img.VipsImage) == 0 || C.vips_icc_is_srgb_iec61966(img.VipsImage) == 1 {
// Don't export is there's no embedded profile
if C.vips_has_embedded_icc(img.VipsImage) == 0 {
return nil
}
@@ -595,8 +595,8 @@ func (img *vipsImage) ExportColourProfile() error {
func (img *vipsImage) ExportColourProfileToSRGB() error {
var tmp *C.VipsImage
// Don't export is there's no embedded profile or embedded profile is sRGB
if C.vips_has_embedded_icc(img.VipsImage) == 0 || C.vips_icc_is_srgb_iec61966(img.VipsImage) == 1 {
// Don't export is there's no embedded profile
if C.vips_has_embedded_icc(img.VipsImage) == 0 {
return nil
}
@@ -612,8 +612,8 @@ func (img *vipsImage) ExportColourProfileToSRGB() error {
func (img *vipsImage) TransformColourProfile() error {
var tmp *C.VipsImage
// Don't transform is there's no embedded profile or embedded profile is sRGB
if C.vips_has_embedded_icc(img.VipsImage) == 0 || C.vips_icc_is_srgb_iec61966(img.VipsImage) == 1 {
// Don't transform is there's no embedded profile
if C.vips_has_embedded_icc(img.VipsImage) == 0 {
return nil
}
@@ -638,10 +638,6 @@ func (img *vipsImage) RemoveColourProfile() error {
return nil
}
func (img *vipsImage) IsSRGB() bool {
return img.VipsImage.Type == C.VIPS_INTERPRETATION_sRGB
}
func (img *vipsImage) LinearColourspace() error {
return img.Colorspace(C.VIPS_INTERPRETATION_scRGB)
}