display JPG or BMP problem

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

display JPG or BMP problem

Postby MajorDill » Jun 04, 2021 3:07

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
Posts: 1525
Joined: Oct 24, 2010 15:16
Location: Ярославль

Re: display JPG or BMP problem

Postby VANYA » Jun 04, 2021 6:14

Try to install: libfreeimage-dev
Posts: 8307
Joined: May 28, 2005 3:28

Re: display JPG or BMP problem

Postby D.J.Peters » Jun 04, 2021 11:46

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


Posts: 2369
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: display JPG or BMP problem

Postby badidea » Jun 04, 2021 21:50

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
      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
   print "Error. No such file?: " & bmp_file_name
end if

BTW: Why is this in section linux?

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest