Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
image read_image(const char *name);
|
||||
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue