Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
image read_image(const char *name);

View file

@ -0,0 +1,28 @@
#include "imglib.h"
#define MAXCMDBUF 100
#define MAXFILENAMELEN 256
#define MAXFULLCMDBUF (MAXCMDBUF + MAXFILENAMELEN)
image read_image(const char *name)
{
FILE *pipe;
char buf[MAXFULLCMDBUF];
image im;
FILE *test = fopen(name, "r");
if ( test == NULL ) {
fprintf(stderr, "cannot open file %s\n", name);
return NULL;
}
fclose(test);
snprintf(buf, MAXFULLCMDBUF, "convert \"%s\" ppm:-", name);
pipe = popen(buf, "r");
if ( pipe != NULL )
{
im = get_ppm(pipe);
pclose(pipe);
return im;
}
return NULL;
}