|
@@ -558,12 +558,7 @@ func (img *vipsImage) 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 {
|
|
@@ -578,8 +573,8 @@ func (img *vipsImage) ImportColourProfile() error {
|
|
func (img *vipsImage) ExportColourProfile() error {
|
|
func (img *vipsImage) 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
|
|
}
|
|
}
|
|
|
|
|
|
@@ -595,8 +590,8 @@ func (img *vipsImage) ExportColourProfile() error {
|
|
func (img *vipsImage) ExportColourProfileToSRGB() error {
|
|
func (img *vipsImage) 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
|
|
}
|
|
}
|
|
|
|
|
|
@@ -612,8 +607,8 @@ func (img *vipsImage) ExportColourProfileToSRGB() error {
|
|
func (img *vipsImage) TransformColourProfile() error {
|
|
func (img *vipsImage) 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
|
|
}
|
|
}
|
|
|
|
|