-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: auto-rotate thumbnails based on metadata #366
feat: auto-rotate thumbnails based on metadata #366
Conversation
9c90543
to
e40637e
Compare
For future reference, I was using Ubuntu 20.04 which had/has an older version of libvips. Any distro with libvips 8.12+ is good as older libvips versions are not as performant. Distros with libvips lower than 8.12 would need to build from source. Older versions are just as problematic as lilliput for generating animated thumbnails because they use imagemagick: https://www.libvips.org/2021/11/14/What's-new-in-8.12.html |
98db221
to
6304d88
Compare
Codecov Report
@@ Coverage Diff @@
## master #366 +/- ##
==========================================
- Coverage 48.91% 48.87% -0.05%
==========================================
Files 98 98
Lines 3146 3159 +13
==========================================
+ Hits 1539 1544 +5
- Misses 1565 1573 +8
Partials 42 42
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
36d7955
to
cc4a28e
Compare
For file formats and metadata that support it (e.g. EXIF), thumbnails will be automatically oriented upright with this commit.
This commit ensures that we only try to build animated thumbnails with lilliput for image formats that support animation. In the other cases, we immediately build the thumbnail using govips.
This name is more inline with `thumbnail.IsAnimatedThumbnailType`, introduced in 0e256b1.
Courtesy of @Leppunen. This was the most time-efficient way to make sure both lilliput and govips can be used in the project since libivps >=8.12 is only available since Ubuntu 22.04.
libvips 8.12 is only available since Ubuntu 22.04 so the workflow runners are bumped to that version. However, this shouldn't be much of a problem as GitHub plans to update ubuntu-latest to 22.04 later this year: actions/runner-images#5998 (comment)
cc4a28e
to
5c4aca7
Compare
Two points:
|
Pull request checklist:
CHANGELOG.md
was updated, if applicableDescription
This PR fixes #336.
libvips is a powerful image processing library in C and govips provides Go bindings for most of its functions. #312 intends to replace lilliput with govips and the library looks promising to be useful when attacking other issues as well (#259, #347, and #363, to name a few), I decided implement this feature with it as well.
Thus, this PR can be seen as a first foray into using govips with a relatively simple and self-contained feature. This also means we can drop the
nfnt/resize
dependency.Other than what @KararTY reported in #312, the
libvips
andlibvips-dev
packages in the Ubuntu 22.04 default repositories were sufficient for me to build this branch.Since I have no way to way to test or develop this on Windows, this feature is limited to Linux. (But this is where I suspect the vast majority of usage to happen anyhow.)
Future Opportunities
As described above, I believe libvips/govips to be helpful in attacking multiple current and future issues. Most notably, if libvips/govips proves viable, #312 may allow us to serve animated thumbnails at a manageable memory cost and replace lilliput altogether.
Testing
When testing on different branches with the same link (e.g.
https://files.catbox.moe/8c5ref.jpeg
, courtesy of #336), make sure to either clear your cache or reupload the image elsewhere to circumvent caching.