Skip to content

Commit c8f8217

Browse files
committed
Additional colour interreptations.
1 parent cd49828 commit c8f8217

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

common-lib/src/main/scala/com/gu/mediaservice/lib/imaging/ImageOperations.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ object ImageOperations extends GridLogging {
287287
case Some(VipsInterpretation.INTERPRETATION_B_W) => Some("Greyscale")
288288
case Some(VipsInterpretation.INTERPRETATION_CMYK) => Some("CMYK")
289289
case Some(VipsInterpretation.INTERPRETATION_LAB) => Some("LAB")
290+
case Some(VipsInterpretation.INTERPRETATION_LABS) => Some("LAB")
291+
case Some(VipsInterpretation.INTERPRETATION_RGB16) => Some("RGB")
290292
case Some(VipsInterpretation.INTERPRETATION_sRGB) => Some("RGB")
291293
case _ => None
292294
}

common-lib/src/test/scala/com/gu/mediaservice/lib/imaging/ImageOperationsTest.scala

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class ImageOperationsTest extends AnyFunSpec with Matchers with ScalaFutures {
2626
val image = fileAt("rgb-wo-profile.jpg")
2727
val colourModelFuture = ImageOperations.getImageInformation(image)
2828
whenReady(colourModelFuture) { colourModel =>
29-
colourModel._3 should be (Some("RGB"))
29+
colourModel._3 should be(Some("RGB"))
3030
}
3131
}
3232

3333
it("should return RGB for a JPG image with RGB image data and an RGB embedded profile") {
3434
val image = fileAt("rgb-with-rgb-profile.jpg")
3535
val colourModelFuture = ImageOperations.getImageInformation(image)
36-
whenReady(colourModelFuture) { colourModel =>
37-
colourModel._3 should be(Some("RGB"))
36+
whenReady(colourModelFuture) { colourModel =>
37+
colourModel._3 should be(Some("RGB"))
3838
}
3939
}
4040

@@ -50,23 +50,47 @@ class ImageOperationsTest extends AnyFunSpec with Matchers with ScalaFutures {
5050
val image = fileAt("rgb-with-cmyk-profile.jpg")
5151
val colourModelFuture = ImageOperations.getImageInformation(image)
5252
whenReady(colourModelFuture) { colourModel =>
53-
colourModel._3 should be (Some("RGB"))
53+
colourModel._3 should be(Some("RGB"))
5454
}
5555
}
5656

5757
it("should return CMYK for a JPG image with CMYK image data") {
5858
val image = fileAt("cmyk.jpg")
5959
val colourModelFuture = ImageOperations.getImageInformation(image)
6060
whenReady(colourModelFuture) { colourModel =>
61-
colourModel._3 should be (Some("CMYK"))
61+
colourModel._3 should be(Some("CMYK"))
6262
}
6363
}
6464

6565
it("should return Greyscale for a JPG image with greyscale image data and no embedded profile") {
6666
val image = fileAt("grayscale-wo-profile.jpg")
6767
val colourModelFuture = ImageOperations.getImageInformation(image)
6868
whenReady(colourModelFuture) { colourModel =>
69-
colourModel._3 should be (Some("Greyscale"))
69+
colourModel._3 should be(Some("Greyscale"))
70+
}
71+
}
72+
73+
it("should return TGB for a PNG image with 16 bit RGB image data") {
74+
val image = fileAt("ProPhoto_32bit (3c0d253874a4a76559672e9e90333aa55a7e38e6) (1).png")
75+
val colourModelFuture = ImageOperations.getImageInformation(image)
76+
whenReady(colourModelFuture) { colourModel =>
77+
colourModel._3 should be(Some("RGB"))
78+
}
79+
}
80+
81+
it("should return LAB for a TIFF image with LAB16 image data") {
82+
val image = fileAt("Lab 16bpc (7d0b7c7b8e890d7e5d369093aa437bd833e20f71).tiff")
83+
val colourModelFuture = ImageOperations.getImageInformation(image)
84+
whenReady(colourModelFuture) { colourModel =>
85+
colourModel._3 should be(Some("LAB"))
86+
}
87+
}
88+
89+
it("should return CMYK for a TIFF image with CMYK image data") {
90+
val image = fileAt("ilkafranz_gracedent-4_NewsprintCMYK (f7e5fd4f0d4a9d3aba8acb65bb19ff936c3a03a9) (f7e5fd4f0d4a9d3aba8acb65bb19ff936c3a03a9).tiff")
91+
val colourModelFuture = ImageOperations.getImageInformation(image)
92+
whenReady(colourModelFuture) { colourModel =>
93+
colourModel._3 should be(Some("CMYK"))
7094
}
7195
}
7296
}

0 commit comments

Comments
 (0)