-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
Expose transformations #555
base: master
Are you sure you want to change the base?
Conversation
An additional flag would also be useful to perform all transformations except for the final rotation as @kmilos says. |
612c4f3
to
2c6fa7d
Compare
I see there is "API to list all transformation properties" was added by @farindk in 602baf4 (v1.16.0) without any pull requests, discussion. Also there was no feedback on this pull request. Implemented API works with You can look at how workflow is organized in Starting from v1.16.0 we need to store the context somewhere else while working with image handlers. There is a way to get |
In my opinion, the current approach is more universal, since it allows you to get heif_item without getting the image handle, and in which case weed out images that are not of interest immediately after heif_context_get_list_of_top_level_image_IDs, and then go work with image handles. |
I have no problems with adding a function to get the I'd like to give you some background why Concerning returning the transformations in a 'canonical' order: this may have some nasty consequences. E.g. rotating and cropping an image may require a conversion to a different chroma format while the other order of rotation and cropping may not require this. Now, in HEIFv2, they specified a scaling transform, which makes things even more difficult. But I like the idea and didn't abandon it. We just have to be very careful that we don't maneuver ourselves into a dead end. |
|
Just for the record, I don't have any questions to this part. It's up to library: provide "close to the file" or more general format. |
@homm I've added an API function to get the |
This PR introduce interface for reading transformations for given
heif_image_handle
.Rationale
The current rotation implementation is pretty straight and that is why inefficient on modern CPUs. For example, It could be up to 8.5 times slower than Pillow's implementation.
There is already an flag
ignore_transformations
which could be used to preventlibheif
from transforming the image. Unfortunately there was no way to get image transformation properties from the file.So, the new struct
heif_transformations
is introduced. It describes image's transformations (information fromirot
,imir
andclap
boxes) in strict order (unlike in the file itself, where operations could be in arbitrary order).In addition, for some cases, transformation from this struct could be used for EXIF construction and actual image rotation could be totally avoided.