Review ExportImage() to use SaveFileData() #1779

This commit is contained in:
Ray 2021-05-20 20:37:46 +02:00
parent 23a08a483e
commit 4a099c3658

View file

@ -416,7 +416,13 @@ bool ExportImage(Image image, const char *fileName)
}
#if defined(SUPPORT_FILEFORMAT_PNG)
if (IsFileExtension(fileName, ".png")) success = stbi_write_png(fileName, image.width, image.height, channels, imgData, image.width*channels);
if (IsFileExtension(fileName, ".png"))
{
int dataSize = 0;
unsigned char *fileData = stbi_write_png_to_mem((const unsigned char *)imgData, image.width*channels, image.width, image.height, channels, &dataSize);
success = SaveFileData(fileName, fileData, dataSize);
RL_FREE(fileData);
}
#else
if (false) {}
#endif