PNG file size in Dalle API


Did anyone else notice large file sizes when generating pictures using the Dalle api?

The same 1024x1024 is 3.1 mb when using the API, compared to ~1.3 mb using the regular DallE website. Also -if I open the 3 mb image and save it as PNG in photoshop, it becomes 1.3 mb as should (and the process is lossless).

Anyone else experience this?

I’m getting this, using OpenAI’s example:
-H “Content-Type: application/json”
-H “Authorization: Bearer YOUR-OPENAI-KEY”
-d ‘{
“prompt”: “a photo of a happy corgi puppy sitting and facing forward, studio light, longshot”,

Anyone coming by this - the following code will decode the base64, save it in 100% quality, and save back to base64 - somehow reducing size by 70%

const compressedPictures = await Promise.all( (picture) => {
const buffer = Buffer.from(picture.b64_json, ‘base64’);
const compressedBuffer = await sharp(buffer).png({ quality: 100 }).toBuffer();
return compressedBuffer.toString(‘base64’);