96 |
|
quiterr("incompatible format"); |
97 |
|
/* put header */ |
98 |
|
printargs(i, argv, stdout); |
99 |
+ |
fputformat(COLRFMT, stdout); |
100 |
|
putchar('\n'); |
101 |
|
fputresolu(YMAJOR|YDECR, head.x, head.y, stdout); |
102 |
|
/* convert file */ |
103 |
|
tg2ra(&head); |
104 |
|
} else { |
105 |
< |
getheader(stdin, NULL); |
106 |
< |
if (fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR)) |
105 |
> |
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
106 |
> |
fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR)) |
107 |
|
quiterr("bad picture file"); |
108 |
|
/* assign header */ |
109 |
|
head.textSize = 0; |
301 |
|
register unsigned char *dp; |
302 |
|
dp = (unsigned char *)tarData + j*3*hp->x; |
303 |
|
for (i = 0; i < hp->x; i++) { |
303 |
– |
*dp++ = inl[i][RED]; |
304 |
– |
*dp++ = inl[i][GRN]; |
304 |
|
*dp++ = inl[i][BLU]; |
305 |
+ |
*dp++ = inl[i][GRN]; |
306 |
+ |
*dp++ = inl[i][RED]; |
307 |
|
} |
308 |
|
} |
309 |
|
} |