GLTFExporter: jpeg textures on export binary and embedImages=false cause validation error
See original GitHub issueHeya,
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!
Issue Analytics
- State:
- Created a year ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
GLTFExporter – three.js docs
External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials,...
Read more >glTF texture export error - Development - VTK Discourse
I have a .vtu file with scalardata that renders fine in VTK viewers but the texture doesn't export correctly to glTF format. I...
Read more >class GLTFExporter | Simplygon 9 Documentation
class GLTFExporter. glTF geometry exporter capable of exporting both glTF and GLB files determined by output path extension. Textures and binary blob files ......
Read more >Exporting Unreal Engine Content to glTF
Use the glTF exporter to export individual Assets or the current Level to one ... It can be difficult to troubleshoot errors caused...
Read more >glTF 2.0 — Blender Manual
Menu: File ‣ Import/Export ‣ glTF 2.0 (.glb, .gltf) ... When image textures are used by materials, glTF requires that images be in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in favor of removing that option. Single-file GLBs are way more popular anyway, and if someone really wants to separate them they can always use
gltf-pipeline
or similar.@Mugen87 Thank you for resolving this bug.
And just to leave a related comment: #23592 works great. I suppose it would be nice to have some way of preserving the source image. Quality loss on jpeg recompression and all that. Maybe something akin to #23592 can be done - store the original texture in
userData
. Just an idea, I’m certainly happy with the status quo.