Skip to content

Commit

Permalink
Revert "Using correct ICC profile while exporting Webp Images (#410)" (
Browse files Browse the repository at this point in the history
…#412)

This reverts commit 5c0bc15.
  • Loading branch information
tonimelisma authored Mar 3, 2024
1 parent 5c0bc15 commit 48c3867
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
4 changes: 1 addition & 3 deletions vips/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,7 @@ func (r *ImageRef) ExportWebp(params *WebpExportParams) ([]byte, *ImageMetadata,
}

paramsWithIccProfile := *params
if r.optimizedIccProfile != "" && params.IccProfile == "" {
paramsWithIccProfile.IccProfile = r.optimizedIccProfile
}
paramsWithIccProfile.IccProfile = r.optimizedIccProfile

buf, err := vipsSaveWebPToBuffer(r.image, paramsWithIccProfile)
if err != nil {
Expand Down
23 changes: 0 additions & 23 deletions vips/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,6 @@ func TestImageRef_WebP__ReducedEffort(t *testing.T) {
assert.NoError(t, err)
}

func TestImageInbuildIcc_WebP(t *testing.T) {
Startup(nil)

srcBytes, err := ioutil.ReadFile(resources + "jpg-24bit-icc-iec.jpg")
require.NoError(t, err)

img, err := NewImageFromBuffer(srcBytes)
require.NoError(t, err)
require.NotNil(t, img)

params := NewWebpExportParams()
exportedWebpBytes, _, err := img.ExportWebp(params)
assert.NoError(t, err)
assert.NotNil(t, exportedWebpBytes)

// Check if the exported webp has the same ICC profile as the original image
exportedImg, err := NewImageFromBuffer(exportedWebpBytes)
require.NoError(t, err)
require.NotNil(t, exportedImg)

assert.Equal(t, img.GetICCProfile(), exportedImg.GetICCProfile())
}

func TestImageRef_WebP__NearLossless(t *testing.T) {
Startup(nil)

Expand Down

0 comments on commit 48c3867

Please sign in to comment.