50 |
|
/* add new header info. */ |
51 |
|
printf("%s\n\n", progname); |
52 |
|
/* get picture size */ |
53 |
< |
if (fgets(buf, sizeof(buf), fin) == NULL || |
54 |
< |
sscanf(buf, "-Y %d +X %d\n", &yres, &xres) != 2) { |
53 |
> |
if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) { |
54 |
|
fprintf(stderr, "%s: bad picture size\n", progname); |
55 |
|
exit(1); |
56 |
|
} |
57 |
|
/* write new picture size */ |
58 |
< |
printf("-Y %d +X %d\n", xres, yres); |
58 |
> |
fputresolu(YMAJOR|YDECR, yres, xres, stdout); |
59 |
|
/* compute buffer capacity */ |
60 |
|
nrows = sizeof(buf)/sizeof(COLR)/yres; |
61 |
|
rotate(fin); /* rotate the image */ |