Close file after writing raw image.

* Fixes #365
This commit is contained in:
iabdalkader 2018-08-10 22:13:30 +02:00
parent 0413d4bbd2
commit 4767229a7c

View File

@ -632,6 +632,7 @@ void imlib_save_image(image_t *img, const char *path, rectangle_t *roi, int qual
FIL fp; FIL fp;
file_write_open(&fp, path); file_write_open(&fp, path);
write_data(&fp, img->pixels, img->w * img->h); write_data(&fp, img->pixels, img->w * img->h);
file_close(&fp);
break; break;
} }
case FORMAT_JPG: case FORMAT_JPG:
@ -648,6 +649,7 @@ void imlib_save_image(image_t *img, const char *path, rectangle_t *roi, int qual
char *new_path = strcat(strcpy(fb_alloc(strlen(path)+5), path), ".raw"); char *new_path = strcat(strcpy(fb_alloc(strlen(path)+5), path), ".raw");
file_write_open(&fp, new_path); file_write_open(&fp, new_path);
write_data(&fp, img->pixels, img->w * img->h); write_data(&fp, img->pixels, img->w * img->h);
file_close(&fp);
fb_free(); fb_free();
} else { // RGB or GS, save as BMP. } else { // RGB or GS, save as BMP.
char *new_path = strcat(strcpy(fb_alloc(strlen(path)+5), path), ".bmp"); char *new_path = strcat(strcpy(fb_alloc(strlen(path)+5), path), ".bmp");