Page 1 of 1
How to show a JPEG or PNG picture in a window?
Posted: Sun Mar 20, 2011 5:44 pm
by programandala.net
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?
Re: How to show a JPEG or PNG picture in a window?
Posted: Sun Mar 27, 2011 7:31 pm
by Mr_Navigator
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?
Re: How to show a JPEG or PNG picture in a window?
Posted: Wed Apr 20, 2011 10:49 pm
by dilwyn
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?
I hope you have found a solution by now -I missed this thread when it first came to the Forum.
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
Re: How to show a JPEG or PNG picture in a window?
Posted: Thu Apr 21, 2011 8:58 pm
by programandala.net
Thank you for the tips. They can be useful. Nevertheless the main issue remains: Photon cannot show the JPEG in a certain window.
dilwyn wrote:
I am trying to contact the author of Photon to get it updated, but without success so far I'm afraid.
Dilwyn
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?
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.
Re: How to show a JPEG or PNG picture in a window?
Posted: Sat Sep 05, 2015 11:49 pm
by Cristian
dilwyn wrote:
I am trying to contact the author of Photon to get it updated, but without success so far I'm afraid.
Dilwyn
Any news

Re: How to show a JPEG or PNG picture in a window?
Posted: Sun Sep 06, 2015 9:27 am
by Derek_Stewart
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.
Re: How to show a JPEG or PNG picture in a window?
Posted: Sun Sep 06, 2015 10:13 am
by Derek_Stewart
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?
Re: How to show a JPEG or PNG picture in a window?
Posted: Sun Sep 06, 2015 1:31 pm
by Cristian
Derek_Stewart wrote:
But this is major software devlopment, is it worth the the effort I wonder?
Derek, thanks for your useful reply, and yes, your question is good.
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.
Re: How to show a JPEG or PNG picture in a window?
Posted: Sun Sep 06, 2015 2:52 pm
by Derek_Stewart
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.
Re: How to show a JPEG or PNG picture in a window?
Posted: Mon Sep 07, 2015 1:43 pm
by Cristian
Derek_Stewart wrote:If you can programme in C [...]
Another idea would be to talk to Davide Santachiara
Alas I cannot programme in C
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...