Page 1 of 1
JPEG, GIF and PNG file conversion
Posted: Tue Jan 19, 2016 7:28 pm
by dilwyn
Thanks to the author of the Photon software, we now have simple to use BASIC extensions which can convert JPEG, GIF and PNG graphics files to QL PIC files on GD2 colour QL compatible systems, making it easier to write QL graphics and viewer programs with simple SBASIC.
The extensions are available to download free of charge from the Graphics page on my website at
http://www.dilwyn.me.uk/graphics/index.html (scroll down to the section just under the entry for 'Photon')
I've written a short article about it on my QL blog at
https://dilwyn2.wordpress.com/
Re: JPEG, GIF and PNG file conversion
Posted: Wed Jan 20, 2016 2:30 pm
by Silvester
Thanks Dilwyn. Now have I completed the most used formats (glad I didn't do TIFF now!), I can finish Photon. Current Web statistics on image formats at :
http://w3techs.com/technologies/overvie ... format/all
Re: JPEG, GIF and PNG file conversion
Posted: Fri Jan 22, 2016 1:07 pm
by BSJR
Thank you Silvester for making these tools, and Dilwyn for distributing.
A quick test shows that it's working very well on QPC2 and much faster then the 'C' based options I used before.
Once I have finalized the addition to my SQRview viewer I will also test it on Aurora but do not expect any problems there because all modes work well on QPC2 and SMSQmulator.
It proves the power of compression. I have one .gif of less than 200KB which will expand to about 13MB of _pic files for all 26 frames!
One question though. In the PNG text there is also a line about the frame% parameter but the FPNG command does'nt accept this parameter. Do PNG's have multi-frames or has this line been copied there by mistake?
BSJR
Re: JPEG, GIF and PNG file conversion
Posted: Fri Jan 22, 2016 2:11 pm
by Silvester
>frame% parameter but the FPNG command doesn't accept this parameter.
Yes, this should have been removed (just re-wrote GIF text).
PNG does do a multi-frame format APNG, but it is not widely supported (you'd be lucky to find many files). AFAIK, Firefox browser supports it, IE doesn't ! Most web pages resort to using GIF for animated/short videos.
There is a lot more to PNG (Gamma etc) which also is rarely used. Perhaps when the base version of Photon is covered I can look at other details. Also have a few optimisations to improve speed (Oh for a 1GHz 68000).
Re: JPEG, GIF and PNG file conversion
Posted: Sat Jan 23, 2016 11:18 am
by BSJR
>frame% parameter but the FPNG command doesn't accept this parameter.
Yes, this should have been removed (just re-wrote GIF text).
Thanks Silvester for clearing that up.
There is a lot more to PNG (Gamma etc) which also is rarely used. Perhaps when the base version of Photon is covered I can look at other details. Also have a few optimisations to improve speed (Oh for a 1GHz 68000).
You also mentioned skipping transparency in PNG for now because the PIC format does not support it. But I think this is a nice opportunity to use/promote the Extended Sprite format with alpha and convert directly to that. Maybe an extra flag/parameter can be used to choose PIC or SPR output
This SPR format could also be an option for multi-frame GIFs. I may attempt to convert my 26 frames example into a SPR and see what RLE compression can shave off the 13MB of raw data.
Although once loaded in QPC it will probably unpack to the full amount.
BSJR
Re: JPEG, GIF and PNG file conversion
Posted: Mon Jan 25, 2016 12:48 pm
by Silvester
Yes, I was tempted to exploit spare byte in PIC header to add features, but thought I'd wait until other things are resolved: RGB format may should have been long word (I did 3 bytes), what was the spare byte to be, 0? (could be Alpha). Should line be rounded up to long word?, what are spare pixels padded with? WSA areas in EasyPtr are long word length, etc, etc...
The functions where just basis for solving decode. An extended PIC format needs to be discussed in detail. It would have been too easy to invent something which would restrict options later.
Re: JPEG, GIF and PNG file conversion
Posted: Mon Jan 25, 2016 1:32 pm
by dilwyn
Silvester wrote:Yes, I was tempted to exploit spare byte in PIC header to add features, but thought I'd wait until other things are resolved: RGB format may should have been long word (I did 3 bytes), what was the spare byte to be, 0? (could be Alpha). Should line be rounded up to long word?, what are spare pixels padded with? WSA areas in EasyPtr are long word length, etc, etc...
The functions where just basis for solving decode. An extended PIC format needs to be discussed in detail. It would have been too easy to invent something which would restrict options later.
Q-Design implements a form of file compression of PIC page files, flagged by varying the unused byte in the 10 byte PIC file preamble. I'm afraid I don't have documentation or example files to know what the file format or even flag value is.
I suppose the obvious way of implementing compression would be to make it the same as the GD2 sprite RLE compression, although as you say needs to be discussed in detail.
Re: JPEG, GIF and PNG file conversion
Posted: Thu Jan 28, 2016 7:57 am
by QLvsJAGUAR
I'm very much looking forward for the improved Photon, Dave.
Re: JPEG, GIF and PNG file conversion
Posted: Thu Jan 28, 2016 12:27 pm
by Silvester
QLvsJAGUAR wrote:I'm very much looking forward for the improved Photon, Dave.
It's taking longer than expected. I had to do GIF and PNG first (from first principles) before I embarked on writing the common routines. Just as well, if I had gone ahead with a RGB output model for all the routines it would have made GIF and PNG decoding a great deal slower. Some of things I hope to do have yet to be proven (so resisted posting features), some already work on some platforms, but not all.