Hi, not really a plugin question per se but this feels like the right board.
Does anyone know the best method for working with CIMG files?
Hi, not really a plugin question per se but this feels like the right board.
Does anyone know the best method for working with CIMG files?
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):
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:
Great thanks again Red. I googled and cimg extension is from a C language library, and I was sure you weren't using that!
Don’t have an account yet? Create a new account now and be part of our community!