|
@@ -580,12 +580,7 @@ func (img *Image) ImportColourProfile() error {
|
|
}
|
|
}
|
|
|
|
|
|
if C.vips_has_embedded_icc(img.VipsImage) == 0 {
|
|
if C.vips_has_embedded_icc(img.VipsImage) == 0 {
|
|
- // No embedded profile
|
|
|
|
- if img.VipsImage.Type != C.VIPS_INTERPRETATION_CMYK {
|
|
|
|
- // vips doesn't have built-in profile for other interpretations,
|
|
|
|
- // so we can't do anything here
|
|
|
|
- return nil
|
|
|
|
- }
|
|
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
|
|
|
|
if C.vips_icc_import_go(img.VipsImage, &tmp) == 0 {
|
|
if C.vips_icc_import_go(img.VipsImage, &tmp) == 0 {
|
|
@@ -600,8 +595,8 @@ func (img *Image) ImportColourProfile() error {
|
|
func (img *Image) ExportColourProfile() error {
|
|
func (img *Image) ExportColourProfile() error {
|
|
var tmp *C.VipsImage
|
|
var tmp *C.VipsImage
|
|
|
|
|
|
- // Don't export is there's no embedded profile
|
|
|
|
- if C.vips_has_embedded_icc(img.VipsImage) == 0 {
|
|
|
|
|
|
+ // 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 {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -617,8 +612,8 @@ func (img *Image) ExportColourProfile() error {
|
|
func (img *Image) ExportColourProfileToSRGB() error {
|
|
func (img *Image) ExportColourProfileToSRGB() error {
|
|
var tmp *C.VipsImage
|
|
var tmp *C.VipsImage
|
|
|
|
|
|
- // Don't export is there's no embedded profile
|
|
|
|
- if C.vips_has_embedded_icc(img.VipsImage) == 0 {
|
|
|
|
|
|
+ // 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 {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -634,8 +629,8 @@ func (img *Image) ExportColourProfileToSRGB() error {
|
|
func (img *Image) TransformColourProfile() error {
|
|
func (img *Image) TransformColourProfile() error {
|
|
var tmp *C.VipsImage
|
|
var tmp *C.VipsImage
|
|
|
|
|
|
- // Don't transform is there's no embedded profile
|
|
|
|
- if C.vips_has_embedded_icc(img.VipsImage) == 0 {
|
|
|
|
|
|
+ // 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 {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|