Skip to content

This new algorithm fixed image rotation when loading from URL#455

Merged
tommyming merged 1 commit intosuzuki-0000:masterfrom
longdaohu:fix-url-image-orientation
Apr 27, 2025
Merged

This new algorithm fixed image rotation when loading from URL#455
tommyming merged 1 commit intosuzuki-0000:masterfrom
longdaohu:fix-url-image-orientation

Conversation

@longdaohu
Copy link
Copy Markdown

This pull request adds a safeguard for handling single-frame images that are processed through the GIF animation path. Currently, when non-GIF images or single-frame GIFs are processed with the animated GIF methods, they can display with incorrect orientation.
The fix creates a specialized helper function that checks the frame count from the CGImageSource. When there's only one frame or fewer, it bypasses the animation logic and handles the image as a standard UIImage, preserving the correct orientation metadata. This maintains backward compatibility while fixing orientation issues for single-frame images.
Tests show this resolves the rotation problems without affecting multi-frame GIF rendering."
Does this capture the essence of your change? Would you like me to adjust the explanation to better fit the specific third-party library's contribution guidelines。
This link is the URL of an image: https://u.maigeai.com/album/2025/3/28/92ac1027.jpg. The preview shows an image with swapped widths and heights, after the fix it doesn't swap.

@longdaohu
Copy link
Copy Markdown
Author

longdaohu commented Mar 31, 2025

Hi Suzuki,
I’ve submitted PR #455 to fix orientation issues for single-frame images in the GIF path. Could you review it when you have time? The changes include a helper function to bypass animation logic for single-frame images. Tests confirm it doesn’t affect multi-frame GIFs.
Let me know if you’d like any adjustments!

@tommyming tommyming self-requested a review April 1, 2025 03:02
@tommyming
Copy link
Copy Markdown
Collaborator

Hi @longdaohu, thanks for creating the pull request! I will try the PR branch within this week.
If everything is okay, I will merge it.

Thanks for contributing!

@longdaohu
Copy link
Copy Markdown
Author

Hi @tommyming, thanks for your quick response and willingness to test the changes! I’m glad to hear you’ll review it this week. If you have any questions or need further adjustments, feel free to let me know. I’m happy to help. Looking forward to your feedback! 😊

@tommyming
Copy link
Copy Markdown
Collaborator

@longdaohu sorry for the late, just finished checking and will merge it now!
Thanks for contributing!

@tommyming tommyming merged commit 15c7f08 into suzuki-0000:master Apr 27, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants