Coder Social home page Coder Social logo

nightmonkeys's Introduction

GitHub Workflow Status Maven Central Sonatype Nexus (Snapshots)

NightMonkeys

A collection of ImageIO plugins, adding support for newer image formats. NightMonkeys uses the newer Foreign Linker API available in JDK 21 to access native libraries.

How it works

NightMonkeys plugins are released as multi-release JARs:

  • with Java < 21, a no-op version of the plugin will unregister itself on load, basically doing nothing
  • with Java 21, the plugin will be available
  • the plugins are not compatible with other Java versions, as the Foreign Linker APIs are still changing

This lets you add the dependencies in your project whatever the JDK used, and still enable the plugin at runtime if the necessary JDK is used.

Supported formats

Plugin Format Read Write Metadata TwelveMonkeys Tests Notes
jxl Jpeg XL - - See limitations in the plugin page
webp WebP - - See limitations in the plugin page
heif HEIF & AVIF - - See limitations in the plugin page

When possible, the plugins will use the extensive test suite from TwelveMonkeys, which covers much more test cases than simple decoding/encoding.

Requirements

In order for the plugins to run properly, you will need to:

  • Run Java 21 with the following options:
--enable-preview --enable-native-access=ALL-UNNAMED
  • Make sure the path to the directory containing the native libraries is contained in the Java system property java.library.path (check also this).
    • For Linux, normally it works fine when installed from a package manager. You can add the libraries' path to the LD_LIBRARY_PATH environment variable.
    • For Mac, if using HomeBrew, you will need to set JAVA_LIBRARY_PATH to /usr/local/lib/ or /opt/homebrew/lib/.

Installation

Gradle

runtimeOnly "com.github.gotson.nightmonkeys:imageio-{plugin}:{version}"

Gradle (Kotlin DSL)

runtimeOnly("com.github.gotson.nightmonkeys:imageio-{plugin}:{version}")

Maven

<dependency>
  <groupId>com.github.gotson.nightmonkeys</groupId>
  <artifactId>imageio-{plugin}</artifactId>
  <version>{version}</version>
  <scope>runtime</scope>
</dependency>

nightmonkeys's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar gotson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nightmonkeys's Issues

Thank you, and a question

First of all, this is a really awesome project: using the new Java 18 Foreign Linker API(instead of JNA) and adding support for JPEG XL to the normal Java ImageIO, meaning using/adopting this lib is really easy to do. You might want to make a post on r/Java to get some more people looking into it.

To the question, are there any plans/roadblocks/ETA for adding writing xlr files? Looking at komga, it's probably the end goal to be able to also read in png files and send them to the client in jxr to save bandwidth on mobile devices.

Java 20 "Missing Foreign Linker API"

I tried to run komga with java 20, and I got this error:

2023-05-14 14:08:04.296  WARN 502417 --- [           main] c.g.g.n.j.i.plugins.JxlImageReaderSpi    : Missing Foreign Linker API, plugin will be disabled. Try adding JVM arguments: --enable-preview

I'm already using this option and everything works correctly with java 19.
This is how I launch komga:

~ $ cat /bin/komga
#!/bin/sh
exec /usr/bin/java --enable-preview -Dforeign.restricted=permit -jar '/usr/share/java/komga/komga.jar' "$@"

Am I doing something wrong?
I tried to search the web, but google can't even find one page with "Missing Foreign Linker API".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.