docs/bevy/release-content/migration-guides/compressed_image_saver.md 1.9 K · 31 lines · raw · history

1 ---
2 title: "`CompressedImageSaver` improvements"
3 pull_requests: [24223, 24904]
4 ---
5
6 The `compressed_image_saver` Cargo feature has been reworked. The old behavior (Basis Universal UASTC compression) has been moved to a new feature called `compressed_image_saver_universal`, and the `compressed_image_saver` feature now uses the `ctt` library to compress textures into BCn (desktop) or ASTC (mobile) formats instead.
7
8 If you were using the `compressed_image_saver` feature and want to keep the previous Basis Universal behavior, rename the feature in your `Cargo.toml`:
9
10 ```toml
11 # Before
12 bevy = { version = "0.19", features = ["compressed_image_saver"] }
13
14 # After (keeps old Basis Universal behavior)
15 bevy = { version = "0.20", features = ["compressed_image_saver_universal"] }
16 ```
17
18 Alternatively, keep using `compressed_image_saver` to get the new BCn/ASTC compression backend. This produces higher-quality output and supports a wider range of input formats, but does not support all platforms in a single file like UASTC does. We recommend sticking to `compressed_image_saver_universal` when targeting the web.
19
20 `CompressedImageSaverError` has a new variant `CompressionFailed`. If you were matching exhaustively on this enum, add a branch for it.
21
22 In Bevy 0.19, `ImagePlugin` registered a default compressed image processor for PNG files. This meant PNG files were automatically compressed if asset processing was enabled, and the processor wasn't overridden by a `.meta` file. In Bevy 0.20, JPEG files have been added to the default processor. The extensions that the default processor uses can also be overridden by `ImagePlugin::default_compressed_image_processor_extensions` - to revert back to the Bevy 0.19 PNG-only behavior:
23
24 ```rust
25 App::new().add_plugins(
26 DefaultPlugins.set(ImagePlugin {
27 default_compressed_image_processor_extensions: ["png".into()].into(),
28 ..Default::default()
29 }),
30 )
31 ```