Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow importing large images #388

Open
ShaddyDC opened this issue Sep 25, 2023 · 0 comments
Open

Allow importing large images #388

ShaddyDC opened this issue Sep 25, 2023 · 0 comments

Comments

@ShaddyDC
Copy link
Contributor

Currently, importing a glTF file with a large image (eg using gltf::import) fails with the error Image(Limits(LimitError { kind: InsufficientMemory })).
This is because, AFAICT, there is a hard limit of 512MB that an allocator may use for images.

More specifically, the call stack looks something like this:

gltf::import("my.glb")
import_path
import_impl
import_images
image::Data::from_source
image_crate::load_from_memory_with_format
free_functions::load
super::Limits::default

with

impl Default for Limits {
    fn default() -> Limits {
        Limits {
            max_image_width: None,
            max_image_height: None,
            max_alloc: Some(512 * 1024 * 1024),
            _non_exhaustive: (),
        }
    }
}

The solution seems to be to instead use a decoder with limits.
I am not sure what an ideal interface to expose this here would be. I think I would like something like image::Data::from_source_with_limits, maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant