gotson / nightmonkeys Goto Github PK
View Code? Open in Web Editor NEWAdditional plug-ins and extensions for Java's ImageIO using native libraries
License: MIT License
Additional plug-ins and extensions for Java's ImageIO using native libraries
License: MIT License
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".
I am experiencing an off-heap memory leak in my test application.
When reading many images, Heap size stays well below the max heap configured for the Application (for example 4GB), but when processing many HEIF images, java commit size grows into the tens of GBs of memory. The JVM dies after a while, because it cannot allocate more memory, as well as other applications on the PC due to memory starvation of the whole system.
imageio-common-0.6.2
imageio-heif-0.6.2
imageio-core-3.10.1
libheif 1.14
OpenJDK 21.0.3.9-hotspot
It is easy to reproduce with this test program:
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream;
import com.github.gotson.nightmonkeys.heif.imageio.plugins.HeifImageReader;
import com.github.gotson.nightmonkeys.heif.imageio.plugins.HeifImageReaderSpi;
public class HEIFReadLoop {
private HeifImageReaderSpi heifSpi = new HeifImageReaderSpi();
private HeifImageReader reader;
public static void main(String[] args) {
HEIFReadLoop l = new HEIFReadLoop();
}
public HEIFReadLoop() {
try {
reader = (HeifImageReader) heifSpi.createReaderInstance();
int counter = 0;
while (true) {
System.out.println("read image " + counter++);
BufferedImage image = readHeicImage(new File("test.heic"));
}
} catch (IOException e) {
e.printStackTrace();
return;
}
}
private BufferedImage readHeicImage(File file) throws IOException {
try (ImageInputStream input = ImageIO.createImageInputStream(file)) {
reader.reset();
reader.setInput(input);
BufferedImage result = reader.read(0);
reader.dispose();
return result;
}
}
}
Run with -Xmx256m given a sufficiently small .heic image.
When you run this test app, Heap size stays well below 256m for a small image.
But system memory used by the java process grows by about 150m each second, untill all available system RAM is consumed.
when I add com.github.gotson.nightmonkeys:imageio-jaxl:0.2.0 I get an error about com.github.gotson.nightmonkeys:imageio-common:jar:0.2.0 missing.
I can't find it in maven central https://search.maven.org/search?q=g:com.github.gotson.nightmonkeys - maybe it was missed ?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.