mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
JPEG: Convert Apple "Display P3" colors to standard sRGB #1474
Other color profiles and file formats are not supported yet. Should be easy to add though. Main difficulty will be profile name comparison: For example "Adobe RGB (1998)" vs just "Adobe RGB".
This commit is contained in:
@@ -4,10 +4,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/face"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/face"
|
||||
"github.com/photoprism/photoprism/pkg/colors"
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
)
|
||||
|
||||
func TestFirstFileByHash(t *testing.T) {
|
||||
@@ -625,3 +626,25 @@ func TestFile_ReplaceHash(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestFile_SetColorProfile(t *testing.T) {
|
||||
t.Run("DisplayP3", func(t *testing.T) {
|
||||
m := FileFixtures.Get("exampleFileName.jpg")
|
||||
|
||||
assert.Equal(t, "", m.ColorProfile())
|
||||
assert.True(t, m.HasColorProfile(colors.Default))
|
||||
assert.False(t, m.HasColorProfile(colors.ProfileDisplayP3))
|
||||
|
||||
m.SetColorProfile(string(colors.ProfileDisplayP3))
|
||||
|
||||
assert.Equal(t, "Display P3", m.ColorProfile())
|
||||
assert.False(t, m.HasColorProfile(colors.Default))
|
||||
assert.True(t, m.HasColorProfile(colors.ProfileDisplayP3))
|
||||
|
||||
m.SetColorProfile("")
|
||||
|
||||
assert.Equal(t, "", m.ColorProfile())
|
||||
assert.True(t, m.HasColorProfile(colors.Default))
|
||||
assert.False(t, m.HasColorProfile(colors.ProfileDisplayP3))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user