Ask HN: Open framework for generating thumbnails on untrusted files?
4 comments
Hi, author of Thumbnailator here.
Just FYI, Thumbnailator itself doesn't delegate processing to native processing -- it's just a wrapper around Java's Image I/O[1] functionality. In other words, it delegates the compression/decompression to loaded Image I/O plugins, hence, whether native processes are used depends on those plugins.
In terms of cross-platform support, the default Image I/O plugins that come with Java shouldn't be much of a concern. For 3rd party ones, IIRC there are some that will use native libraries, while others are pure Java. One good library on the Image I/O plugins front is TwelveMonkeys ImageIO[2], which provides plugins to support a wide variety of image formats.
1: https://docs.oracle.com/javase/8/docs/technotes/guides/image...
2: https://github.com/haraldk/TwelveMonkeys
Just FYI, Thumbnailator itself doesn't delegate processing to native processing -- it's just a wrapper around Java's Image I/O[1] functionality. In other words, it delegates the compression/decompression to loaded Image I/O plugins, hence, whether native processes are used depends on those plugins.
In terms of cross-platform support, the default Image I/O plugins that come with Java shouldn't be much of a concern. For 3rd party ones, IIRC there are some that will use native libraries, while others are pure Java. One good library on the Image I/O plugins front is TwelveMonkeys ImageIO[2], which provides plugins to support a wide variety of image formats.
1: https://docs.oracle.com/javase/8/docs/technotes/guides/image...
2: https://github.com/haraldk/TwelveMonkeys
Perhaps you may be interested in Qubes OS, security-oriented OS, which allows to convert untrusted images to trusted ones using a disposable VM: https://github.com/QubesOS/qubes-app-linux-img-converter/blo...
This is very cool, thank you. Spinning up a dedicated VM for this seems very heavyweight though, especially on client machines.
I have searched the web and github (and had ChatGPT do that too) and while there are some frameworks out there like `preview-generator` in the python ecosystem and `thumbnailator`, they all seem to shell out to native handlers. While native handlers are all well and good and there are good examples for extensible plugin systems with native code, it does complicate things for runtime extensibility.
My initial thought was to define a simple function API and have the "handlers" implemented in WebAssembly such that they can be loaded and runtime and effectively sandboxed, one shot stream processors.
Does anyone know if anything project like this already exists, or does anyone have any advice?