display JPG or BMP problem

Linux specific questions.
Post Reply
MajorDill
Posts: 29
Joined: Sep 07, 2009 6:03
Location: Augusta, Kentucky

display JPG or BMP problem

Post by MajorDill »

could someone give me an example of how to display a picture on the screen in Linux (jpg, bmp, whatever)

I found the example in the "examples" portion of the documentation but it doesn't seem to work for me

the first statement in the example:
#include "/usr/local/include/freebasic/FreeImage.bi"
throws an error:
ld: cannot find -lfreeimage

and I've checked "FreeImage.bi" is there...so

what is the simplest way...thankx
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: display JPG or BMP problem

Post by VANYA »

Try to install: libfreeimage-dev
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: display JPG or BMP problem

Post by D.J.Peters »

We have fbimage it doesn't need any extra runtime libray it's a static lib !

Programming->Libraries->fbimage

Joshy
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: display JPG or BMP problem

Post by badidea »

If only 'bmp' is enough:

Code: Select all

#include "fbgfx.bi"

function load_bmp(file_name as string) as fb.image ptr
	dim as long file_num = freefile()
	dim as ulong image_width, image_height
	dim as fb.image ptr pImage
	if open(file_name, for binary, access read, as file_num) = 0 then
		get #file_num, 18+1, image_width
		get #file_num, 22+1, image_height
		close #file_num
		pImage = imagecreate(image_width, image_height) 'allocate image memory
		bload(file_name, pImage) 'bitmap into memory
		return pImage
	else
		return 0
	end if
end function

screenres 800,600,32
dim as string bmp_file_name = "test.bmp"
dim as fb.image ptr pImage = load_bmp(bmp_file_name)
if pImage <> 0 then
	put(20, 20), pImage, pset
	imagedestroy(pImage)
else
	print "Error. No such file?: " & bmp_file_name
end if
getkey()
BTW: Why is this in section linux?
Post Reply