DPaint-js icon indicating copy to clipboard operation
DPaint-js copied to clipboard

IFF - Can't parse file

Open warpdesign opened this issue 1 year ago • 9 comments
trafficstars

I found a sample iff file that from what I read can be opened with Photoshop, but DPaint-js produces random pixels instead.

I don't have PhotoShop so I could not see the expected output.

warpdesign avatar Jun 23 '24 22:06 warpdesign

image

Deluxe Paint can't open that file as well. (I guess software from the early 90's also isn't supposed to open 3840x5760 24 bit images :-) ) PhotoShops IFF implementation is - I assume - mostly targeted towards Maya. it certainly is not compatible with anything Deluxe Paint related. (Photoshop can't read Deluxe Paint IFF files and vica versa)

I'll take a quick look what causing it, but as IFF is by design a container format where every program can define it own chunks, it's probably Photoshop specific, and probable a bit out of scope.

But still ... could be easy to implement.

steffest avatar Jun 24 '24 05:06 steffest

Oh Interesting! I didn't know Maya supported IFF.

Btw I was unable to find grayscale IFF files (these don't have a CMAP chunk and are usually 8 bpp or less from what I could read). Any idea where I could find or how to generate one?

Couldn't Deluxe Paint V open IFF-24 pictures? I thought so. I'll dig up my original CD to find out.

warpdesign avatar Jun 24 '24 07:06 warpdesign

Yes Deluxe Paint V can open IFF-24 bit pictures (and so can dpaint.js) But this is not a standard one.

image

Interestingly, some Amiga 24-bit image editors open it with the exact same garbled pixels as dpaint.js, so at least there's some consistency. :-)

image

And double interestingly: if the latest IFF datatypes are installed, multiview on Amiga CAN open it ... (and surprisingly fast) image

OK, I'm intrigued. Time is limited this week, but I'll figure it out next week.

steffest avatar Jun 24 '24 11:06 steffest

Hmm.. that's interesting.

ffmpeg also outputs garbage. I wrote an ILBM decoder for SerenityOS: I'll see what happens there.

Nicolas RAMZ - http://www.warpdesign.fr/

AthenaJS - https://athenajs.github.io

On Mon, Jun 24, 2024 at 1:24 PM Steffest @.***> wrote:

Yes Deluxe Paint V can open IFF-24 bit pictures (and so can dpaint.js) But this is not a standard one.

image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/d60241d4-b98b-4c79-8673-7232e3cfba48

Interestingly, some Amiga 24-bit image editors open it with the exact same garbled pixels as dpaint.js, so at least there's some consistency. :-)

image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/f3039cab-6400-482e-a59a-57144074f494

And double interestingly: if the latest IFF datatypes are installed, multiview on Amiga CAN open it ... (and surprisingly fast) image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/3a705213-7771-4f82-aa61-3afd5af8c211

OK, I'm intrigued. Time is limited this week, but I'll figure it out next week.

— Reply to this email directly, view it on GitHub https://github.com/steffest/DPaint-js/issues/27#issuecomment-2186343519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQXYCA42OC77KGETJAZZ3ZI76XFAVCNFSM6AAAAABJYXQ7B6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGM2DGNJRHE . You are receiving this because you authored the thread.Message ID: @.***>

warpdesign avatar Jun 24 '24 12:06 warpdesign

That may be a hint: some 24bit ILBM files may be encoded using a different ordering:

R7 G7 B7 R6 G6 B6 R5 G5 B5 R4 G4 B4 R3 G3 B3 R2 G2 B2 R1 G1 B1 R0 G0 B0 instead of R0-R7,G0-B7,B0-B7

Nicolas RAMZ - http://www.warpdesign.fr/

AthenaJS - https://athenajs.github.io

On Mon, Jun 24, 2024 at 2:48 PM Nicolas Ramz @.***> wrote:

Hmm.. that's interesting.

ffmpeg also outputs garbage. I wrote an ILBM decoder for SerenityOS: I'll see what happens there.

Nicolas RAMZ - http://www.warpdesign.fr/

AthenaJS - https://athenajs.github.io

On Mon, Jun 24, 2024 at 1:24 PM Steffest @.***> wrote:

Yes Deluxe Paint V can open IFF-24 bit pictures (and so can dpaint.js) But this is not a standard one.

image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/d60241d4-b98b-4c79-8673-7232e3cfba48

Interestingly, some Amiga 24-bit image editors open it with the exact same garbled pixels as dpaint.js, so at least there's some consistency. :-)

image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/f3039cab-6400-482e-a59a-57144074f494

And double interestingly: if the latest IFF datatypes are installed, multiview on Amiga CAN open it ... (and surprisingly fast) image.png (view on web) https://github.com/steffest/DPaint-js/assets/763047/3a705213-7771-4f82-aa61-3afd5af8c211

OK, I'm intrigued. Time is limited this week, but I'll figure it out next week.

— Reply to this email directly, view it on GitHub https://github.com/steffest/DPaint-js/issues/27#issuecomment-2186343519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQXYCA42OC77KGETJAZZ3ZI76XFAVCNFSM6AAAAABJYXQ7B6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGM2DGNJRHE . You are receiving this because you authored the thread.Message ID: @.***>

warpdesign avatar Jun 24 '24 14:06 warpdesign

@steffest hey, did you have time to have a look at this special files? By any chance would the sources to the DataTypes you're using be available? (Yeah, I know Amiga developers like to keep everything to themselves and reinvent the wheel constantly :))

warpdesign avatar Feb 07 '25 13:02 warpdesign

@warpdesign Yes, I "left" it a the presumption that it's a file with "out of spec" headers.

Luckily, times have changed and the Amiga community have embraced open source and is sharing knowledge these days. Sources of these DataTypes are at https://aminet.net/package/util/dtype/ILBMdt

That packages includes an Amiga tool called "fixiff" that tries to fix some "commonly encountered problems with IFF ILBM files"

-> The fixiff tool will correct incorrect IFF FORM header sizes, convert out-of-spec run-length encoding to valid encoding, trim extra data and fill up incomplete BODY data with zeros.

The datatype uses those fixes on the fly. (You got to love that datatype system on the Amiga, it's utterly BRILLIANT)

After running that lady.iff image through that tool, dpaint.js can open the image. (still, VERY slowly though ... javascript :-) ) I haven't yet investigated what exactly is causing the problem in the original file, nor have I looked into the source code yet. If you're interested, ~~I've attached the "fixed" IFF file~~.

Github won't let me upload IFF or ZIP, you can download the lady_fixed IFF file at https://www.stef.be/dpaint/testfiles/lady_fixed.zip

steffest avatar Feb 10 '25 13:02 steffest

Oh now that's interesting! I'll have a look and see if a fix can be implemented :) I'll also have a look at the slow decoding in js: I'm sure it can be made faster.

warpdesign avatar Feb 10 '25 18:02 warpdesign

And yes: datatypes were an interesting concept which made old apps support formats that did not even exist when the OS was written. Too bad it did not support streaming. Also, I remember using software with their own decoders because datatypes were too slow.

warpdesign avatar Feb 10 '25 20:02 warpdesign