bevyengine / bevyengine/bevy

Ability to get dimensions of image file

Open
#10,982 6 comments 0 reactions 0 assignees View on GitHub
A-Assets C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

When loading an image asset from a file, there doesn’t seem to be any way to easily get the dimensions of the image. This makes it really annoying to do things dependent on image size (like dwarf-fortress style tile sets where you have a fixed layout and number of tiles but the actual size of those tiles is dependent on the actual texture size).

## What solution would you like?

A way to easily get the dimensions of an image file in the assets directory, preferably while loading the asset so this can be done in startup systems.

## What alternative(s) have you considered?

I could use a separate mechanism to access the image file outside of bevy’s asset-handling machinery, but that would probably add extra dependencies and really complicate things.

## Additional context

In many game engines, such as macroquad or dragonruby, this is a natively supported feature. It is quite essential for doing any kind of one-time calculations that depend on the size of a texture, and its omission in bevy seems like an oversight.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bevy’s asset-loading path for image assets and the existing image or texture APIs. Determine how dimensions can be exposed while loading so startup systems can use them, then verify that image files report their dimensions without requiring a separate file-access mechanism.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.