In our ongoing series about Handling common image file formats in Java we move our focus onto how we can read SGI images in Java.
What is SGI?
SGI (Silicon Graphics Image) is a file type of images with the extensions .sgi and .rgb. It has 2-channel support (.bw for black and white), 3-channel support (rgb/bwa) and 4-channel support (rgba). The ‘a’ represents alpha.
There are not many libraries out there that can read SGI images. Our JDeli Image library can read and write a very wide range of image formats, including SGI. Here is the full list on Image file conversions supported.
How to read SGI images in Java?
//Read Image (can also be OutputStream or byte array) File sgiFile = new File("sgiImage.sgi"); BufferedImage image = JDeli.read(sgiFile);
Or you can use the JDeli SgiDecoder directly:
SgiDecoder decoder = new SgiDecoder(); BufferedImage image = decoder.read(rawImageBytes);
You can find more tutorials in our series on handling common image formats in Java, JDeli and other image libraries.