Read Alt Text From An Image/Photo In Rust
This is a work in progress.
The goal here is to come up with a way to read the IPTC metadata information for an image to pull the alt text automatically for Neopoligen.
Note that I had to install gexiv2 to get this to work. I did this on my mac with: `brew install gexiv2``
Code
```cargo
rexiv2 = "0.10"
```
Results
Ok([])
[/Users/alan/.cargo/target/55/19854259915251/_active_nvim_run:13:7] meta.has_iptc() = false
[/Users/alan/.cargo/target/55/19854259915251/_active_nvim_run:14:7] meta.supports_iptc() = true
[/Users/alan/.cargo/target/55/19854259915251/_active_nvim_run:15:7] meta.has_xmp() = true
Notes
When I saved the image as a .png in Photoshop 2023 the metadata didn't show up for the "Headline". When I saved the same file as a ".jpg" it worked. Need to figure out what's going on there.
I don't see way in Photoshop to write the specific alt tags.
NOTE: This is the original response I got when I tired to run the process.
error: failed to run custom build command for `gexiv2-sys v1.4.0`
Caused by:
process didn't exit successfully: `/Users/alan/.cargo/target/55/19854259915251/debug/build/gexiv2-sys-ae7041b700b82523/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=GEXIV2_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=GEXIV2_STATIC
cargo:rerun-if-env-changed=GEXIV2_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
The gexiv2 library was not found by pkg-config on your system.
Consult the README.md file for suggestions on how to acquire it.
--- stderr
thread 'main' panicked at /Users/alan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gexiv2-sys-1.4.0/build.rs:28:13:
pkg-config exited with status code 1
> PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gexiv2
The system library `gexiv2` required by crate `gexiv2-sys` was not found.
The file `gexiv2.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
The PKG_CONFIG_PATH environment variable is not set.
HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `gexiv2.pc`.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace