Apply Exif orientation when decoding a wallpaper - #142
Merged
Conversation
mmstick
requested changes
Jul 13, 2026
Cameras store portrait photos with the pixels laid out landscape and record the rotation in the Exif metadata. `ImageReader::decode` ignores it, so those wallpapers are drawn rotated. It is also why such a photo looks right in an image viewer but rotated in the wallpaper and in the cosmic-settings preview. Decode through `into_decoder` instead, so the orientation reported by the decoder can be applied to the decoded image. Unlike `decode`, `into_decoder` does not check the allocation limit against the size of the decoded image, so that check is kept explicitly. Fixes pop-os#135 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Leandro Pérez G. <leandropatodo@gmail.com>
LeandroPG19
force-pushed
the
exif-orientation
branch
from
July 13, 2026 16:06
e32fbb9 to
59dea13
Compare
mmstick
approved these changes
Jul 13, 2026
Member
|
Similar changes will be needed for cosmic-settings for cosmic-greeter |
5 tasks
leviport
approved these changes
Jul 23, 2026
mmstick
pushed a commit
to pop-os/cosmic-settings
that referenced
this pull request
Jul 24, 2026
Same fix as pop-os/cosmic-bg#142, which was asked for there. `open_image` has two decoding paths, and neither applies the Exif orientation: `ImageReader::decode` for the common formats, and `DynamicImage::from_decoder` in `decode_jpegxl`. Cameras store portrait photos with the pixels laid out landscape and record the rotation in the Exif metadata, so such a photo is shown rotated in the wallpaper page, both in the preview and in the thumbnails. Both paths now read the orientation from the decoder and apply it to the decoded image. `into_decoder` does not check the allocation limit against the size of the decoded image the way `decode` does, so that check is kept explicitly. Tested with the 8 Exif orientation values, with images that carry no Exif metadata (unchanged), and with the JPEG XL wallpapers from gnome-backgrounds, which decode identically. cosmic-greeter needs a different change: it does not decode images itself. It passes the raw file bytes to `widget::image::Handle::from_bytes` (src/common.rs), and those are decoded by `iced_graphics` with `image::load_from_memory`, which does not apply the orientation either. So the orientation has to be applied before the handle is built, or in the toolkit. - [x] I have disclosed use of any AI generated code in my commit messages. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions. Signed-off-by: Leandro Pérez G. <leandropatodo@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Softer
added a commit
to Lin-WMDE/wmde-bg
that referenced
this pull request
Jul 30, 2026
Brings in one upstream commit: apply EXIF orientation when decoding a wallpaper (upstream pop-os#142). The merge was clean with a single auto-merged conflict in src/wallpaper.rs (no manual resolution needed) - decode() now reads orientation from the image decoder and applies it to the DynamicImage before use. No Cargo.toml version bump needed (both sides already at 1.2.0), no i18n .ftl files in this crate, and no debian/ resurrection. Brand sweep found only pre-existing internal CosmicBg/CosmicConfigEntry type names (load-bearing, not rebrand leftovers) - nothing to change.
krakotay
pushed a commit
to krakotay/cosmic-settings
that referenced
this pull request
Aug 10, 2026
Same fix as pop-os/cosmic-bg#142, which was asked for there. `open_image` has two decoding paths, and neither applies the Exif orientation: `ImageReader::decode` for the common formats, and `DynamicImage::from_decoder` in `decode_jpegxl`. Cameras store portrait photos with the pixels laid out landscape and record the rotation in the Exif metadata, so such a photo is shown rotated in the wallpaper page, both in the preview and in the thumbnails. Both paths now read the orientation from the decoder and apply it to the decoded image. `into_decoder` does not check the allocation limit against the size of the decoded image the way `decode` does, so that check is kept explicitly. Tested with the 8 Exif orientation values, with images that carry no Exif metadata (unchanged), and with the JPEG XL wallpapers from gnome-backgrounds, which decode identically. cosmic-greeter needs a different change: it does not decode images itself. It passes the raw file bytes to `widget::image::Handle::from_bytes` (src/common.rs), and those are decoded by `iced_graphics` with `image::load_from_memory`, which does not apply the orientation either. So the orientation has to be applied before the handle is built, or in the toolkit. - [x] I have disclosed use of any AI generated code in my commit messages. - [x] I understand these changes in full and will be able to respond to review comments. - [x] My change is accurately described in the commit message. - [x] My contribution is tested and working as described. - [x] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions. Signed-off-by: Leandro Pérez G. <leandropatodo@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Photos taken in portrait are drawn rotated. Cameras store the pixels laid out
landscape and record the rotation in the Exif metadata, and
ImageReader::decodeignores it. It is also why the same photo looks right in an image viewer but
rotated in the wallpaper and in the cosmic-settings preview.
Decoding through
into_decodergives access to the orientation the decoderreports, so it can be applied to the decoded image.
into_decoderdoes notcheck the allocation limit against the size of the decoded image the way
decodedoes, so that check is kept explicitly.Fixes #135
Tested with the 8 Exif orientation values, with images that carry no Exif
metadata (unchanged), and with the wallpapers in /usr/share/backgrounds, which
decode byte for byte identically.