To create images with transparencies without too much scaffolding, use the netpgm-associated format PAM, and then use
pamtotiff
.
#include
int main() {
printf("P7\n");
printf("WIDTH 256\n");
printf("HEIGHT 256\n");
printf("DEPTH 4\n");
printf("MAXVAL 255\n");
printf("TUPLTYPE RGB_ALPHA\n");
printf("ENDHDR\n");
unsigned int row,col;
for (row=0; row<256; row++) {
for (col=0; col<256; col++) {
printf("%c", (char)col); // RED
printf("%c", (char)(255-col)); // GREEN
printf("%c", (char)row); // BLUE
printf("%c", (char)(255-row)); // OPACITY
}}
return 0;
}