Skip to content

GLTFExporter: jpeg textures on export binary and embedImages=false cause validation error #23962

@852Kerfunkle

Description

@852Kerfunkle

Heya,

when exporting a material with a jpeg texture as a .glb with these options:

{
    binary: true,
    embedImages: false
}

The resulting .glb has a validation error:

      {
        "code": "IMAGE_MIME_TYPE_INVALID",
        "message": "Recognized image format 'image/jpeg' does not match declared image format 'image/png'.",
        "severity": 0,
        "pointer": "/images/0"
      },

It seems three.js exports the texture with the image/png mime type, regardless of what type the image actually is: ...,"images":[{"mimeType":"image/png","uri":"data:image/jpeg;base64,....

I had a brief look around but couldn't find a way to set the mime type manually (but maybe I missed something...).

Working example: https://framer.tz1and.com/
Source: https://github.com/tz1and/image-framer/blob/main/src/index.js

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions