Export Babylon scene to GLB/GLTF always turns textures into .png format

Hi, I have been experimenting with exporting my scenes as GLTF/GLB, and it seems like every texture I have imported automatically gets turned from a .jpg into a .png, increasing the total file size of my export significantly.
Is there a way to get around this?

Basic repro: https://playground.babylonjs.com/#20OAV9#9730
It loads a JPG, but exports and downloads a PNG.

The only way to chose your mimeType would be to prevent any kind of texture conversion so use a PBR Material, and a metallic workflow. Then you would need to force a chosen mimeType on the texture upon creation to conserve it.


Thanks, this seems to work in this case.
Is it also possible to define the mimeType on an AssetManager’s TextureAssetTask (TextureAssetTask | Babylon.js Documentation)?
Playground: https://playground.babylonjs.com/#20OAV9#9733

I do not think so but you might force it through _mimeType after loading ? if that works we ll try to find a proper way to fill it in.

The following indeed works:

const textureTask = assetsManager.addTextureTask("woodTex", url);
textureTask.onSuccess = function (task) {
    const texture = task.texture;
    texture._mimeType = "image/jpeg";
    wood.albedoTexture = task.texture;

Alternatively I got it to work by loading it as a binary file first:

const binaryTextureTask = assetsManager.addBinaryFileTask("woodTexBinary", url);
binaryTextureTask.onSuccess = (task) => {
    const tex = new BABYLON.Texture(task.url, scene, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "image/jpeg");
    wood.albedoTexture = tex;

Thanks for your help!

Full playground with both tests: https://playground.babylonjs.com/#20OAV9#9740