mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-29 11:26:17 +03:00
use mode structs in File.c
This commit is contained in:
parent
bc1f506d5a
commit
e6d2f9a642
|
@ -23,14 +23,13 @@ int
|
|||
ImagingSaveRaw(Imaging im, FILE *fp) {
|
||||
int x, y, i;
|
||||
|
||||
if (strcmp(im->mode, "1") == 0 || strcmp(im->mode, "L") == 0) {
|
||||
if (im->mode == IMAGING_MODE_1 || im->mode == IMAGING_MODE_L) {
|
||||
/* @PIL227: FIXME: for mode "1", map != 0 to 255 */
|
||||
|
||||
/* PGM "L" */
|
||||
for (y = 0; y < im->ysize; y++) {
|
||||
fwrite(im->image[y], 1, im->xsize, fp);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* PPM "RGB" or other internal format */
|
||||
for (y = 0; y < im->ysize; y++) {
|
||||
|
@ -58,10 +57,10 @@ ImagingSavePPM(Imaging im, const char *outfile) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(im->mode, "1") == 0 || strcmp(im->mode, "L") == 0) {
|
||||
if (im->mode == IMAGING_MODE_1 || im->mode == IMAGING_MODE_L) {
|
||||
/* Write "PGM" */
|
||||
fprintf(fp, "P5\n%d %d\n255\n", im->xsize, im->ysize);
|
||||
} else if (strcmp(im->mode, "RGB") == 0) {
|
||||
} else if (im->mode == IMAGING_MODE_RGB) {
|
||||
/* Write "PPM" */
|
||||
fprintf(fp, "P6\n%d %d\n255\n", im->xsize, im->ysize);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user