• English

2019-04-16: A new hotfix ( is now available!

  • 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):

    Java Source Code

    1. //Your CIMG file
    2. File cimg = new File(path-to-cimg-file);
    3. //Read the file bytes
    4. byte[] bytes = Utils.FileUtils.readBytesFromFile(cimg);
    5. //Wrap bytes
    6. ByteBuffer buffer = ByteBuffer.wrap(bytes);
    7. //First two bytes determine img version (ignore this)
    8. short imageVersion = buffer.getShort();
    9. //Next four bytes describe data length
    10. int len = buffer.getInt();
    11. //Read PNG data
    12. byte[] pngData = new byte[len];
    13. buffer.get(pngData);
    Display All

    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 Source Code

    1. try(ByteArrayInputStream bis = new ByteArrayInputStream(pngData)){
    2. BufferedImage bufferedImage =;
    3. }
    4. catch(IOException e){
    5. //error occurred
    6. }