Basically the CIMG format is just a PNG image with some additional data (e.g. information about the uploader, original image name and dimensions etc).
The first two bytes contain the "image version" (just ignore this), and the next four bytes contain the actual data length (number of bytes). When writing a plugin, you could use this code to turn a CIMG-File into a PNG byte[] (using the API Utils class):
//First two bytes determine img version (ignore this)
short imageVersion = buffer.getShort();
//Next four bytes describe data length
int len = buffer.getInt();
//Read PNG data
byte[] pngData = new byte[len];
buffer.get(pngData);
Display More
The next update will contain a method to convert a (png) byte array into a buffered image and vice versa. But it's fairly simple to convert a byte[] into a buffered image (using the javax ImageIO class). This code turns our "pngData" byte[] into a buffered image:
Java
try(ByteArrayInputStream bis = new ByteArrayInputStream(pngData)){