How to show a JPEG or PNG picture in a window?
- programandala.net
- Chuggy Microdrive
- Posts: 74
- Joined: Mon Dec 13, 2010 12:41 pm
- Location: Spain
- Contact:
How to show a JPEG or PNG picture in a window?
I'm writing a program in SBASIC (with QPC2 on Debian+Wine), and I need it to show some grey scale pictures in a window.
The BMPCVT toolkit (by W. Lenerz) adds a keyword that does what I need: WL_BMP8LOAD. The manual says it loads 8-bit (256-colour) BMP files, but it seems to load higher colour resolutions (in fact I've found no way yet to create 8-bit BMPs in my Debian system - even the Photoshop-like huge GIMP doesn't has the option; and tinkering with the ImageMagick toolkit has given no result yet).
Well, the problem is BMPs are very big and I'm afraid the final WIN file will be too large (my plan is to publish the program in a WIN file ready to be booted with the QPC2 demo). JPEG or PNG would be better options.
I've found Photon (by Dave Westbury). I haven't tried it yet, but it seems it only shows JPEGs on the whole screen and doesn't provide a keyword to load a picture into a window. The source code of Photon is not distributed with the program, so I think I will contact the author anyway.
Is there any alternative?
The BMPCVT toolkit (by W. Lenerz) adds a keyword that does what I need: WL_BMP8LOAD. The manual says it loads 8-bit (256-colour) BMP files, but it seems to load higher colour resolutions (in fact I've found no way yet to create 8-bit BMPs in my Debian system - even the Photoshop-like huge GIMP doesn't has the option; and tinkering with the ImageMagick toolkit has given no result yet).
Well, the problem is BMPs are very big and I'm afraid the final WIN file will be too large (my plan is to publish the program in a WIN file ready to be booted with the QPC2 demo). JPEG or PNG would be better options.
I've found Photon (by Dave Westbury). I haven't tried it yet, but it seems it only shows JPEGs on the whole screen and doesn't provide a keyword to load a picture into a window. The source code of Photon is not distributed with the program, so I think I will contact the author anyway.
Is there any alternative?
Marcos Cruz (programandala.net)
- Mr_Navigator
- QL Fanatic
- Posts: 782
- Joined: Mon Dec 13, 2010 11:17 pm
- Location: UK, Essex
- Contact:
Re: How to show a JPEG or PNG picture in a window?
It would be a useful feature and as you haven't had any response, I would suggest you try the mailing list although that has gone a bit quiet recently.
The program you say works with the whole screen (Photon) would that be a WINDOW screen perhaps, as that may be sizeable?
The program you say works with the whole screen (Photon) would that be a WINDOW screen perhaps, as that may be sizeable?
-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
Re: How to show a JPEG or PNG picture in a window?
I hope you have found a solution by now -I missed this thread when it first came to the Forum.programandala.net wrote:I'm writing a program in SBASIC (with QPC2 on Debian+Wine), and I need it to show some grey scale pictures in a window.
I've found Photon (by Dave Westbury). I haven't tried it yet, but it seems it only shows JPEGs on the whole screen and doesn't provide a keyword to load a picture into a window. The source code of Photon is not distributed with the program, so I think I will contact the author anyway.
Is there any alternative?
With Photon, you can "grab" a copy of its output as follows:
QDOS:
EX photon;"filename":pause 300:sbytes "filename2",131072,32768
SMSQ:
EX photon;"filename":pause 300:sbytes "filename2",SCR_BASE,SCR_LLEN*SCR_YLIM
(you might have to change the value of the PAUSE to give Photon enough time to render the jpeg on your system, perhaps)
I think you can turn the Photon executable into a keyword with the Tascom (or Task Commander - not sure which name it has these days) so that BASIC or compiled basic programs can call Photon as a keyword: PHOTON "filename"
I am trying to contact the author of Photon to get it updated, but without success so far I'm afraid.

Dilwyn
--
All things QL - https://dilwyn.theqlforum.com
All things QL - https://dilwyn.theqlforum.com
- programandala.net
- Chuggy Microdrive
- Posts: 74
- Joined: Mon Dec 13, 2010 12:41 pm
- Location: Spain
- Contact:
Re: How to show a JPEG or PNG picture in a window?
Thank you for the tips. They can be useful. Nevertheless the main issue remains: Photon cannot show the JPEG in a certain window.
It would be great if he would grant to publish the source code under a free software license.
no source code + author missing = work lost OR reinvent the wheel
Open source / free software lets anyone to contribute, improve, debug... for the benefit of the whole community. And that doesn't mean the author cannot sell the program as well. I still wonder why the QL scene has so few free software. Perhaps because of its solid roots in the 1980's and the way things worked those days, before Internet.
I tried too, with the same result. I tried the e-mail mentioned in Photon's docs. Perhaps he still subscribes the QL-Users list, did you try it?dilwyn wrote: I am trying to contact the author of Photon to get it updated, but without success so far I'm afraid.![]()
Dilwyn
It would be great if he would grant to publish the source code under a free software license.
no source code + author missing = work lost OR reinvent the wheel
Open source / free software lets anyone to contribute, improve, debug... for the benefit of the whole community. And that doesn't mean the author cannot sell the program as well. I still wonder why the QL scene has so few free software. Perhaps because of its solid roots in the 1980's and the way things worked those days, before Internet.
Marcos Cruz (programandala.net)
Re: How to show a JPEG or PNG picture in a window?
Any newsdilwyn wrote: I am trying to contact the author of Photon to get it updated, but without success so far I'm afraid.![]()
Dilwyn

-
- Font of All Knowledge
- Posts: 4684
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: How to show a JPEG or PNG picture in a window?
Hi,
Maybe Photon could be disassembled, but it would not have any comments.
I am sure I must of done this in the past, as I used to disassemble most programmes to learn how to programme in assembler.
If I have not done this, I can get this done easily, as I believe Dave Westbury, programmed Photon in assembler, so should be straight forward to reverse engineer it.
Maybe Photon could be disassembled, but it would not have any comments.
I am sure I must of done this in the past, as I used to disassemble most programmes to learn how to programme in assembler.
If I have not done this, I can get this done easily, as I believe Dave Westbury, programmed Photon in assembler, so should be straight forward to reverse engineer it.
Regards,
Derek
Derek
-
- Font of All Knowledge
- Posts: 4684
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: How to show a JPEG or PNG picture in a window?
It seems I have partially disassembled Photon in DISA and DEA.
Problem is to understand the code.
Maybe we need a dedicated graphics application that images file can be loaded in for manipulation or consversion, like ImageMagik or The Gimp.
But this is major software devlopment, is it worth the the effort I wonder?
Problem is to understand the code.
Maybe we need a dedicated graphics application that images file can be loaded in for manipulation or consversion, like ImageMagik or The Gimp.
But this is major software devlopment, is it worth the the effort I wonder?
Regards,
Derek
Derek
Re: How to show a JPEG or PNG picture in a window?
Derek, thanks for your useful reply, and yes, your question is good.Derek_Stewart wrote: But this is major software devlopment, is it worth the the effort I wonder?
But let me inform you about this: in the Italian QL mailing list is growing the interest of fixing some bugs and lacks of Photon.
We have some possible options:
- try again to contact Dave Westbury to get the code;
- make a little donation to him (or to everyone having the skills) to improve Photon.
A new message wil follow describing what exactly these lacks are.
-
- Font of All Knowledge
- Posts: 4684
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: How to show a JPEG or PNG picture in a window?
Hi,
I do not think Dave is reachable these days, I did have some old Fidonet messages from Dave with regards to Photon, but the source was never released.
If you can programme in C, there lis libjpeg, which could be used as a starting point for the processing of JPEG files.
Another idea would be to talk to Davide Santachiara, who may be able to help, while Open World did support Jpeg, maybe it could be adapted.
I do not think Dave is reachable these days, I did have some old Fidonet messages from Dave with regards to Photon, but the source was never released.
If you can programme in C, there lis libjpeg, which could be used as a starting point for the processing of JPEG files.
Another idea would be to talk to Davide Santachiara, who may be able to help, while Open World did support Jpeg, maybe it could be adapted.
Regards,
Derek
Derek
Re: How to show a JPEG or PNG picture in a window?
Alas I cannot programme in CDerek_Stewart wrote:If you can programme in C [...]
Another idea would be to talk to Davide Santachiara

Moreover I'm not sure that Davide will be available....
Anyway, let me try to open a specific topic explaining what exactly are our needs from Photon. Maybe someone else could suggest other ideas...