Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Using correct ICC profile while exporting Webp Images (#410)" #412

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading