Skip to content
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

Add support for higher bit depth AVIF and HEIF images #322

Merged
merged 1 commit into from
Nov 1, 2022

Conversation

AttilaTheFun
Copy link
Contributor

Back in February, John helped me add support for loading and saving 8/10/12 bit HEIC and AVIF files to libvips here:
libvips/libvips#2596

Now with the release of iOS 16 / MacOS Ventura which support AVIF images natively, I want to add support for them to my app.

I asked about this a while ago here: #313 and finally had some time to implement it myself.

The changes in this PR are as follows:

  • I cleaned up the HEIF / AVIF export parameters so they both now take a Bitdepth parameter like PNGs. Also libvips has renamed "speed" to "effort" so I migrated us to use that parameter name with backwards support for the speed parameter for code that used it.
  • I added golden image tests for 8bit AVIF and encoding a 16bit TIF to a 12bit AVIF.
  • The files I touched got auto formatted by gofmt so we should probably just commit those changes to avoid annoying future PR authors.

@AttilaTheFun
Copy link
Contributor Author

Hi again @tonimelisma and @davidbyttow 😊
I just updated to iOS 16 and MacOS Ventura and I was excited to add AVIF support to my app.
Let me know what you think!

@AttilaTheFun
Copy link
Contributor Author

Ah I see this failed the CI job because of the error:
heifsave_buffer: no property named `bitdepth'

I suspect this is because the builders have libvips 8.12.X or earlier while this param was added in 8.13.X which I have locally. I'll add a check for the libvips version.

@coveralls
Copy link

coveralls commented Oct 29, 2022

Coverage Status

Coverage increased (+0.01%) to 76.907% when pulling ca7625a on AttilaTheFun:lshire-avif-bit-depth into ce49ee9 on davidbyttow:master.

@tonimelisma tonimelisma enabled auto-merge (squash) October 30, 2022 23:53
@tonimelisma
Copy link
Collaborator

Hey @AttilaTheFun it's difficult to read the PR as you've used a different formatter for the code. It looks like 90% of the changes are just line breaks and spacing? Would it be possible to remove these changes and just show the actual code changes?

@AttilaTheFun
Copy link
Contributor Author

Hey Tony! Sure thing -- I can do that after dinner.

I use VSCode with the default Go tools installed, though. It might be worth running gofmt once on the entire codebase for one commit rather having people fighting the formatter on every pr.

I think there is a way to create a gofmt config that is checked into the repo if you don't like the default settings.

@tonimelisma
Copy link
Collaborator

I think all Go formatting is the same, unless you're adding line breaks manually to existing code. It's probably the C code formatting which you have different settings for.

auto-merge was automatically disabled October 31, 2022 17:00

Head branch was pushed to by a user without write access

@AttilaTheFun
Copy link
Contributor Author

Hi @tonimelisma -- yeah it was the C code being auto formatted causing most of the issues.
I disabled the VSCode auto-formatting and reverted the unrelated changes. Hopefully this is more readable now.

Copy link
Collaborator

@tonimelisma tonimelisma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tonimelisma tonimelisma merged commit 7881bfa into davidbyttow:master Nov 1, 2022
Elad-Laufer pushed a commit to wix-incubator/govips-contrib that referenced this pull request Nov 22, 2022
Elad-Laufer added a commit to wix-playground/govips that referenced this pull request Nov 22, 2022
* Original image type (davidbyttow#299)

* - add golden

* - freeCString abstraction

* When implicitly converting the image type (BMP to PNG), keep the original format available for query

* gaussian blur support min_ampl (davidbyttow#307)

Co-authored-by: muyouran <muyouran@pinduoduo.com>

* Add APIs to get image EXIF data and ICC profile data (davidbyttow#317)

* Add support for high-bit-depth AVIF and HEIF images (davidbyttow#322)

* Fix bug with icc transform bit depth (davidbyttow#323)

* Determine libvips version runtime (davidbyttow#320)

* add ExtractBandToImage (davidbyttow#324)

* Update image.go

Add function to extract a band into a new image instead of replacing the current image ref

* Update image.go

* add test

Co-authored-by: Roffe <roffe@roffe.nu>

* BandSplit() split an n-band image into n separate images (davidbyttow#326)

* BandSplit() split an n-band image into n separate images

* move tests

Co-authored-by: Roffe <roffe@roffe.nu>

* Bump CI to latest Ubuntu (davidbyttow#329)

* Improved exif extraction (davidbyttow#325)

* Add support for reading + writing EXIF data

* Fix test for removing exif

* Cleanup tests

* Fix removes exif test on ubuntu

* TIFF may not iptc data

* Cleanup test images

* add images for ubuntu 22 lts (davidbyttow#328)

Co-authored-by: Roffe <roffe@roffe.nu>

* don't use deprecated functions

Co-authored-by: Qisen <1620671486@qq.com>
Co-authored-by: muyouran <muyouran@pinduoduo.com>
Co-authored-by: Logan Shire <logan.shire@gmail.com>
Co-authored-by: tgmpje <65441725+tgmpje@users.noreply.github.com>
Co-authored-by: Joakim Karlsson <5434736+roffe@users.noreply.github.com>
Co-authored-by: Roffe <roffe@roffe.nu>
Co-authored-by: Toni Melisma <59022391+tonimelisma@users.noreply.github.com>
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.

3 participants