2019-03-03 16:22:55 +01:00
|
|
|
/*
|
|
|
|
* PNG ---> FIMG
|
2020-11-09 20:27:57 +01:00
|
|
|
*
|
|
|
|
* Attention : certains fichiers PNG ne passent pas cette
|
|
|
|
* moulinette, mais le bug est dans la bibliotheque de
|
|
|
|
* fonctions 'libpnglite'. Une solution de remplacement
|
|
|
|
* devrait etre a l'etude un de ces jours...
|
2019-03-03 16:22:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "../floatimg.h"
|
|
|
|
|
2019-06-29 23:50:03 +02:00
|
|
|
int verbosity = 0;
|
|
|
|
|
2019-03-03 16:22:55 +01:00
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
FloatImg fimg;
|
|
|
|
int foo;
|
|
|
|
|
2020-11-09 20:27:57 +01:00
|
|
|
/*
|
|
|
|
* pas de traitement des options ?
|
|
|
|
*/
|
|
|
|
|
2019-03-03 16:22:55 +01:00
|
|
|
if (3 != argc) {
|
|
|
|
fimg_print_version(1);
|
2019-09-11 19:22:19 +02:00
|
|
|
fprintf(stderr, "usage:\n\t%s foo.png bar.fimg\n", argv[0]);
|
2019-03-03 16:22:55 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&fimg, 0, sizeof(FloatImg));
|
|
|
|
|
|
|
|
foo = fimg_create_from_png(argv[1], &fimg);
|
|
|
|
if (foo) {
|
|
|
|
fprintf(stderr, "%s : err %d, abort.\n", argv[0], foo);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2020-11-09 20:27:57 +01:00
|
|
|
if (verbosity) fimg_describe(&fimg, argv[2]);
|
2019-03-03 16:22:55 +01:00
|
|
|
|
2019-09-11 18:55:30 +02:00
|
|
|
foo = fimg_dump_to_file(&fimg, argv[2], 0);
|
|
|
|
fprintf(stderr, "save as fimg -> %d\n", foo);
|
2019-03-03 16:22:55 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|