char ext[5]; if (strlen(filename) != 0) { char *p = strrchr(filename, '.'); if (p != NULL) strcpy(ext, p+1); } strlwr(ext);  if ((strcmp (ext, "jpg") == 0) || (strcmp (ext, "jpeg") == 0)) return SaveJPG(filename, image, opts->quality, opts->interlaced);  if (strcmp (ext, "gif") == 0) { FileDisk file; if (!file.Open(filename, "wb")) return false;  bool ret = SaveGIF(&file, image, opts->transparent, opts->interlaced, opts->background); file.Close(); return ret; }  if (strcmp (ext, "bmp") == 0) return SaveBMP(filename, image, opts->truecolor == false);  if (strcmp (ext, "png") == 0) return SavePNG(filename, image, opts->transparent, opts->interlaced, opts->background);    return false;
if (opts->format != LC_IMAGE_GIF) return false; return SaveGIF(file, image, opts->transparent, opts->interlaced, opts->background);
bool SaveImage(char* filename, LC_IMAGE* image, LC_IMAGE_OPTS* opts){	char ext[5];	if (strlen(filename) != 0)	{		char *p = strrchr(filename, '.');		if (p != NULL)			strcpy(ext, p+1);	}	strlwr(ext);	if ((strcmp (ext, "jpg") == 0) || (strcmp (ext, "jpeg") == 0))		return SaveJPG(filename, image, opts->quality, opts->interlaced);	if (strcmp (ext, "gif") == 0)	{		FileDisk file;		if (!file.Open(filename, "wb"))			return false;		bool ret = SaveGIF(&file, image, opts->transparent, opts->interlaced, opts->background);		file.Close();		return ret;	}	if (strcmp (ext, "bmp") == 0)		return SaveBMP(filename, image, opts->truecolor == false);	if (strcmp (ext, "png") == 0)		return SavePNG(filename, image, opts->transparent, opts->interlaced, opts->background);//	MessageBox (NULL, "Could not save file", "Error", MB_ICONSTOP);	return false;}