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

Tweak README intro and sample output #18

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
# vips-ffm

A thin wrapper to let Java/JVM projects use [libvips](https://github.com/libvips/libvips), via the
"Foreign Function & Memory API" ([JEP 454](https://openjdk.org/jeps/454)) released in JDK 22.
[libvips](https://github.com/libvips/libvips) bindings for JVM projects, using the "Foreign Function & Memory API"
([JEP 454](https://openjdk.org/jeps/454)) released in JDK 22. The combination of libvips and FFM makes for performant, safe, and ergonomic image
manipulation in JVM systems, supporting a vast range of image formats, including HEIC, JXL, WebP, PNG, JPEG, and more.
Pronounced "vips (like zips) eff-eff-emm".

Incubating in [Photo Fox](https://github.com/lopcode/photo-fox). Pronounced "vips (like hips) eff-eff-emm".
Bindings are automatically generated using `jextract`, and enhanced with some helpful wrapper functions to make usage
more idiomatic.

Incubating in [Photo Fox](https://github.com/lopcode/photo-fox).

## Project goals

* Publish to GitHub Packages via Gradle, so that using the library is as easy as
`implementation("app.photofox:vips-ffm-core:$version")`
* Automate as much as possible, including API generation via `jextract`, so upstream changes can be rapidly integrated
* Core module should only include this automated output, with a minimum of extra things that can break as ImageMagick
changes
`implementation("app.photofox:vips-ffm-core:$version")` (TODO)
* Automate as much as possible, including API generation via [jextract](https://github.com/openjdk/jextract), so
upstream changes can be rapidly integrated ✅
* Core module should only include this automated output, with a minimum of extra things that can break as upstreams
change ✅
* If helpers are required, publish in another artifact
* Incubate in Photo Fox with some "real world" usage

## Proof of concept
## Samples

Samples are included that show various usages of the `libvips` bindings. They include validations, and run on GitHub
Actions to validate new versions during development.

This project includes a proof of concept that only runs on macOS. To run it:
To get set up to run samples (on macOS):
* `brew install vips`
* `sdk use java 22-open`
* `./setup_lib_symlinks.sh`
* (Optional, to regenerate bindings) `./generate_ffm_bindings.sh`
* Run `VipsFfm` in IntelliJ to run samples and validations

### Example output
* Then either:
* Run `./run_samples.sh` in your terminal
* Run `VipsFfm` in IntelliJ to run samples and validations

```
[main] INFO vipsffm.VipsFfm - clearing sample run directory at path "sample_run"
[main] INFO vipsffm.VipsFfm - running sample "GetVersionSample"...
[main] INFO vipsffm.GetVersionSample - libvips version: "8.15.2"
[main] INFO vipsffm.VipsFfm - validation succeeded ✅
[main] INFO vipsffm.VipsFfm - running sample "CreateThumbnailSample"...
[main] INFO vipsffm.GetVersionSample - source image size: 2490 x 3084
[main] INFO vipsffm.GetVersionSample - output image size: 323 x 400
[main] INFO vipsffm.VipsFfm - validation succeeded ✅
[main] INFO vipsffm.VipsFfm - all samples ran successfully 🎉
```