aaargh. My bad.
That is what you get when reading about picture storage formats when the topic is about icon storage
The best documentation I have found so far seems to be that of evillabs but imho there is still some ambiguity how exactly things are stored. e.g. i have a difficult time interpretating what it actually means. In that regards I should perhaps better focus first on the imag chunk decryption to see what is about exactly
Ofc i can take a peek at an existing library and/or code that loads these icons but I would like to figure it out myself first before looking at an actual implementation from someone else.
I have some information that may help. I can post it tomorrow.
I also found this when looking at the Amiga Icon Converter that is written in Java.
But the note was interesting concerning Reading IFF Icon Data.
// note: this is BIT aligned, not byte aligned ...
// -> RLE control chars are 8 bits, but the data elements are n bits, determined by depth
Which may or may not indicate that the image data is RLE compressed but the data itself is planar by depth.
To test the image data I borrowed an image decoder from another program. It reads the icon image data. It's very similar to the decoder as used in icon library to read OS35 icons. I finally got the decoder to output data for my test program but it only works at full size ,(width * height).
Curiously I couldn't figure out why my ILBM images were still scattered and fuzzy. The images were scrambled. But then I realized that I may be expecting the wrong out put format. I will do some tests to verify.
When all else fails I will put a --v switch in my test program to optionally view the images so I can draw them on the screen. If that works then the decoder output format is 8bit chunky bytes not planar data as I had expected.
For example the decoder was using a strange formula if the image data in the IMAG chunk is uncompressed the output size is (imgsize * 8/depth) which if the image has 4 bitplanes is (imgsize * 8/4). It's twice as large. That's very puzzling!