Quick Paint question
Rick Murray (539) 13850 posts |
I’m looking at the recent changes while on break at work and I see Paint now supports exporting PNG (and JPEG). Quick question – with PNG, does this include transparency? |
John WILLIAMS (8368) 495 posts |
Quick answer: Doesn’t seem to! Tried the !Patience Sprites22, and colours were wrong and no transparency! But Spr2Png wouldn’t even handle it, complaining about a palette deficiency! |
Rick Murray (539) 13850 posts |
Looks like neither understands the non-paletted 256 colour palette (that is to say, the default colour selection of 256 colour modes).
Okey-dokey, so that’s a “no” to using RISC OS to edit web graphics then. :-/ |
Andrew Rawnsley (492) 1445 posts |
RO Adjust !Paint was quite good with import/export of transparencies, so even if ROOL initial attempt isn’t perfect, I’m sure it is possible to end up in a reasonable place. How to edit 8 bit alpha masks might be more “interesting”. |
Andy Vawer (5817) 28 posts |
That’s odd. It should be handling those sprites OK including any mask or alpha channel. If there’s no palette, then a default one is requested from ColourTrans. I have tried it here on !Patience Sprites22 and it gives me correct output. However, my ones have palettes for the 90×90 dpi images. The 90×45s are palette free and convert OK. But it may be that we have different sprite files… Could you send me a copy of your !Patience Sprites22 to test against (andy CompressPNG needs to be the latest version to get correct handling of transparency with output of less than true colour PNGs as there were some additions for mapping palette values to an alpha level. There is currently a bug (mentioned elsewhere) compressing sprites with alpha channels that occasionally overflows its image buffer and crashes on completion; I have a fix for that but would like to make sure that any other transparency/palette issues are fixed before submitting. |
Andy S (2979) 504 posts |
How to edit 8 bit alpha masks might be more “interesting”. I’m working on it. I’ve already got a UI that can successfully create sprites with alpha masks and alpha channels as well. |
David Pitt (3386) 1248 posts |
This may or may not be relevant. From NetSurf’s ASprites22 the !netsurf icon, which has an 8bpp Alpha mask, does not export a PNG correctly, it is the wrong colour and aspect ratio. *help compressPNG ==> Help on keyword CompressPNG Module is: CompressPNG 0.06 (17 Mar 2021) * |
Andy Vawer (5817) 28 posts |
Interesting. I can recreate the problem with that sprite – that’s good (well, bad, but useful). The rest of the sprites in the file seem to convert fine here, masks/alpha channels too. But !netsurf certainly comes out wrong. I will look into it further… |
Gerald Holdsworth (2084) 81 posts |
I used that very sprite file to test out Sprite Converter, while I was writing it, for creating the Alpha mask. I have looked into that file in some detail, so if there is any help I can offer just let me know. |
Andy Vawer (5817) 28 posts |
Thanks for the offer, Gerald. However, I’ve found the issue with !netsurf. The creator was trying to create a 256 colour PNG with full alpha channel for this sprite which isn’t a valid PNG format (PNG only allows a full alpha channel if it’s true colour). The output stream of [palette][alpha][palette][alpha] was being read as [ R][G][B][alpha] so giving a half width funny coloured output (but with alpha channel!) I have fixed it to upscale to 24bit RGB in these situations where there’s a full alpha channel. If it’s just a simple on/off mask and there’s a free colour to be allocated to the mask from the palette then masked 256 (or fewer) colour PNGs can be created. I’ve submitted the fix, but suspect the ROOL people will be rather busy right now! If anyone is desperate to give it a whirl and is happy to compile their own then there is a fix at https://spock.vawer.com/PaintPatch.zip containing the updated file. Just replace c.Export in the Paint source and compile. |
David Pitt (3386) 1248 posts |
That’s a fix. (And it fixes the other issue I reported.) |