Call read_image

I can call an image that is a jpeg, but how do I call a Bitmap image?


Zavala - Call read_image problem

Hi jonathan,

If you had used TrueBasic to create the jpeg image from a boxkeep, using the "Call write_image", and had specified "JPEG", that is probably the problem.

TB will ONLY save a boxkeep in the "MS BMP" file format, even if you specify the the file as "JPEG" in the Call write_image command.

The file will be so named as a ".jpg", but it will actually be in .bmp format.

Then when you try to use "Call read_image", TB will expect the .jpg format but the file will actually be a .bmp, and an error results.

TB WILL read a REAL .jpg file.

So the trick is, if YOU are going to save boxkeeps as images they can only be saved as "MS BMP"s, and must be read as such.

Hope this solves the problem.

Mike C.

re: read_image

CALL read_image("MS BMP",variablename$,"filename.bmp")


Im having a similar issue

I cant seem to be able to open the picture file
The code i have is
Call read_image("jpeg",image$,"garlic_bread.jpeg")
Box show image$ at 0,0

I have the image in the same file as the program it keeps saying "failed to create temporary file"
Worst part is my project is due tomorrow all help is appreciated thx


Ok, I just didn't know the MS BMP. Thank you very much


Well, I haven't been here a while, but am now back, with a new problem. First, I have no way to put a new topic up, as the webpage tells me that I am not allowed to post new content to any forum. This is the only way I can say something here. (I have already e-mailed the admins, asking of any way to fix this). Second, JPG images are no longer enough, as I need transparencies in one of my programs, and have just found out that JPEG files do not support transparencies. I would use .PNG's, but I do not know what you put in for the following line of code:
CALL READ_IMAGE("???",image_name$,image_location$)
Please help.

re: .png

read_image is part of the core language now (no such thing back in the DOS days--you had to create and save graphics in the TB BOX KEEP format.) What this means is that it is not an easy task to modify the routine. The limitations are that it only works with JPEG, MS BMP, PICT (Mac), and perhaps (I've never tried) OS/2 BMP and PCX formatted files. So at this point in time (AFAIK) any other graphics format would need to be converted to one of the supported types before you can get it into your TB program. This looks like something to put on the wish list--read_image to support more graphics formats. However, what read_image does is to convert the image into the internal BOX KEEP format, so I'm not sure the features you want in the image would be preserved.

OTOH--you CAN do graphics that have 'transparent' sections using MS BMP if you use MASKS and then do your box shows with the USING "and" and USING "or". If you need a tutorial on that put your contact info here and I can send you some instructions. If you want to see what one can do, you could download the Animated Chalkboard, Special Relativity package from my web site and run the BARN PARADOX animation to see what one can do with transparent sections of graphics in True Basic.