Merge pull request #7310 from radarhere/cmyk2rgb

This commit is contained in:
Hugo van Kemenade 2023-10-06 01:43:50 -06:00 committed by GitHub
commit 5957f109a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -340,6 +340,10 @@ class TestLibUnpack:
self.assert_unpack("RGB", "G;16N", 2, (0, 1, 0), (0, 3, 0), (0, 5, 0)) self.assert_unpack("RGB", "G;16N", 2, (0, 1, 0), (0, 3, 0), (0, 5, 0))
self.assert_unpack("RGB", "B;16N", 2, (0, 0, 1), (0, 0, 3), (0, 0, 5)) self.assert_unpack("RGB", "B;16N", 2, (0, 0, 1), (0, 0, 3), (0, 0, 5))
self.assert_unpack(
"RGB", "CMYK", 4, (250, 249, 248), (242, 241, 240), (234, 233, 233)
)
def test_RGBA(self): def test_RGBA(self):
self.assert_unpack("RGBA", "LA", 2, (1, 1, 1, 2), (3, 3, 3, 4), (5, 5, 5, 6)) self.assert_unpack("RGBA", "LA", 2, (1, 1, 1, 2), (3, 3, 3, 4), (5, 5, 5, 6))
self.assert_unpack( self.assert_unpack(

View File

@ -564,7 +564,7 @@ rgb2cmyk(UINT8 *out, const UINT8 *in, int xsize) {
} }
} }
static void void
cmyk2rgb(UINT8 *out, const UINT8 *in, int xsize) { cmyk2rgb(UINT8 *out, const UINT8 *in, int xsize) {
int x, nk, tmp; int x, nk, tmp;
for (x = 0; x < xsize; x++) { for (x = 0; x < xsize; x++) {

2
src/libImaging/Convert.h Normal file
View File

@ -0,0 +1,2 @@
extern void
cmyk2rgb(UINT8 *out, const UINT8 *in, int xsize);

View File

@ -31,6 +31,7 @@
*/ */
#include "Imaging.h" #include "Imaging.h"
#include "Convert.h"
#define R 0 #define R 0
#define G 1 #define G 1
@ -1589,6 +1590,7 @@ static struct {
{"RGB", "R;16B", 16, band016B}, {"RGB", "R;16B", 16, band016B},
{"RGB", "G;16B", 16, band116B}, {"RGB", "G;16B", 16, band116B},
{"RGB", "B;16B", 16, band216B}, {"RGB", "B;16B", 16, band216B},
{"RGB", "CMYK", 32, cmyk2rgb},
/* true colour w. alpha */ /* true colour w. alpha */
{"RGBA", "LA", 16, unpackRGBALA}, {"RGBA", "LA", 16, unpackRGBALA},