mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
unpack CMYK TIFFs optional channels
This commit is contained in:
parent
e5bd7eb623
commit
1f4fd49a80
|
@ -233,6 +233,10 @@ OPEN_INFO = {
|
|||
|
||||
(II, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"),
|
||||
(MM, 5, (1,), 1, (8, 8, 8, 8), ()): ("CMYK", "CMYK"),
|
||||
(II, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"),
|
||||
(MM, 5, (1,), 1, (8, 8, 8, 8, 8), (0,)): ("CMYK", "CMYKX"),
|
||||
(II, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"),
|
||||
(MM, 5, (1,), 1, (8, 8, 8, 8, 8, 8), (0, 0)): ("CMYK", "CMYKXX"),
|
||||
|
||||
(II, 6, (1,), 1, (8, 8, 8), ()): ("YCbCr", "YCbCr"),
|
||||
(MM, 6, (1,), 1, (8, 8, 8), ()): ("YCbCr", "YCbCr"),
|
||||
|
|
|
@ -1041,6 +1041,28 @@ copy4(UINT8* out, const UINT8* in, int pixels)
|
|||
memcpy(out, in, 4 * pixels);
|
||||
}
|
||||
|
||||
static void
|
||||
copy4skip1(UINT8* _out, const UINT8* in, int pixels)
|
||||
{
|
||||
int i;
|
||||
UINT32* out = (UINT32*) _out;
|
||||
for (i = 0; i < pixels; i++) {
|
||||
out[i] = *(UINT32*)&in[0];
|
||||
in += 5;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
copy4skip2(UINT8* _out, const UINT8* in, int pixels)
|
||||
{
|
||||
int i;
|
||||
UINT32* out = (UINT32*) _out;
|
||||
for (i = 0; i < pixels; i++) {
|
||||
out[i] = *(UINT32*)&in[0];
|
||||
in += 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Unpack to "I" and "F" images */
|
||||
|
||||
|
@ -1344,6 +1366,8 @@ static struct {
|
|||
|
||||
/* colour separation */
|
||||
{"CMYK", "CMYK", 32, copy4},
|
||||
{"CMYK", "CMYKX", 40, copy4skip1},
|
||||
{"CMYK", "CMYKXX", 48, copy4skip2},
|
||||
{"CMYK", "CMYK;I", 32, unpackCMYKI},
|
||||
{"CMYK", "CMYK;L", 32, unpackRGBAL},
|
||||
{"CMYK", "C", 8, band0},
|
||||
|
|
Loading…
Reference in New Issue
Block a user