DioxusLabs / DioxusLabs/dioxus

Auto width/height for manganis images

Open
#5,458 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue manganis
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

## Feature Request

You can currently not set the image size for images or set both the width and height. You should be able to set either the width or height and have the other derived from the aspect ratio of the image

## Implement Suggestion

Allow `with_width` or `with_height` and derive the other dimension

```rust
// Resize the image at compile time to make the assets smaller
pub const RESIZED_PNG_ASSET: Asset =
asset!("/assets/image.png", AssetOptions::image().with_width(52));
```

or

```rust
// Resize the image at compile time to make the assets smaller
pub const RESIZED_PNG_ASSET: Asset =
asset!("/assets/image.png", AssetOptions::image().with_height(52));
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.