BBC BASIC for Windows
Programming >> BBC BASIC language >> how do I load and save a bmp image?
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1461210571

how do I load and save a bmp image?
Post by michael on Apr 21st, 2016, 03:49am

In order to make my next app.. BMPTOCODE for BBC Basic I need to know how to load a bmp image (255) color BMP and then I can read the information and compress it so small that it only occupies a few lines of code.
Can I get assistance with this?
Re: how do I load and save a bmp image?
Post by DDRM on Apr 21st, 2016, 08:09am

Hi Michael,

You can use *LOAD to load a file into memory: you'll need to reserve space first using DIM.

Since it's a bitmap, you might consider making a DIBSection for the screen, as has been used in several recent posts, and then using *DISPLAY to load the bitmap into it: that way you'd automatically get a pointer to the start of the image data.

I'm looking forward to seeing how you compress the image data into a program!

smiley

D
Re: how do I load and save a bmp image?
Post by hellomike on Apr 21st, 2016, 08:19am

Michael,

There is example code in the manual!
See: http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#gifjpeg

Note that Quote:
This routine will also display Windows Bitmap (.BMP or .ICO) and Windows Metafile (.WMF or .EMF) images.


Please show us the result when it works.

Good luck.

Mike
Re: how do I load and save a bmp image?
Post by michael on Apr 21st, 2016, 3:07pm

Thanks a lot.
I do have a few products of BMPTOCODE in forums.
One is the Message box exclamation point called
"Looks like you have an error Notice Box"
and
"A sky full of rating stars"
Keep in mind that BMPTOCODE is meant for making images no larger than 100x100 and the image must not be too complex. (also the image MUST be the same width and height and you can only use the colors in paint that I specify)

(more complexity)= larger code

But that is from the modified version and would require
mostly a rebuild or BMPTOCODE (except for the compression technique)