Java ImageIO plugin that adds support for Netpbm image files.
Netpbm is a toolkit for manipulation of graphics images. It used to be popular on Unix systems to do image manipulation such as scaling, cropping, creating sequences, etc.
Although still supported by most Unix systems the Toolkit itself is considered a bit obsolete. But the simple image formats that come with the toolkit might still be useful. These image files are not very economical when it comes to their storage size but their simple structure might have some benefits over other file formats. For instance, the plain text versions of these files are human readable, and the raw formats are basically just a a binary stream of the bitmaps image data. This makes them still be useful as an intermediate format or when developing software for example.
The Netpbm ImageIO plugin currently provides read support for the three most common Netpbm image file formats, which are:
- pbm or portable bitmap (monochrome bitmap)
- pgm or portable graymap (grayscale bitmap)
- ppm or portable pixelmap (RGB bitmap)
Both raw/binary and plain text formats are supported.
The project is an implementation of an ImageIO plugin. This means that once built, the resulting jar only needs to be available on your project's classpath. If so, java ImageIO will automatically add support for Netpbm image files. For instance, if you are are using Maven:
- Build the plugin so that it will be available in your local maven repository:
mvn clean install
- Add the dependency to your project's pom.xml:
...
<dependencies>
<dependency>
<groupId>org.scrivo.imageio</groupId>
<artifactId>imageio-netpbm</artifactId>
<version>1.0.0</version>
</dependency>
...
</dependencies>
...
- Then use it as follows:
BufferedImage img = ImageIO.read("/home/geert/image.bpm");
That should be all there is to it.
The build in Eclipse code formatter was used with the exception that it was set to maintain line breaks in code.
The code passes a SonarLint check based on SonarLint's default settings.
- The people of the Netpbm project (current maintainer: Bryan Henderson)
- The plugin code was adopted from Writing Image I/O Plug-ins
- Sample images were used from Wikipedia, The Gimp and Potrace