How to use the @gltf-transform/core.GLTFUtil.getImageSize function in @gltf-transform/core

To help you get started, we’ve selected a few @gltf-transform/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donmccurdy / glTF-Transform / packages / atlas / src / atlas.ts View on Github external
let images = baseColorImages.map((index) => {
    const image = container.json.images[index];
    const arrayBuffer = container.resolveURI(image.uri);
    const mimeType = image.mimeType || (image.uri.match(/\.png$/) ? 'image/png' : 'image/jpeg');
    atlasIsPNG = atlasIsPNG || mimeType === 'image/png';
    const {width, height} = GLTFUtil.getImageSize(container, index);
    return {index, width, height, arrayBuffer, mimeType, x: undefined, y: undefined};
  });