Search code examples
bitmapdebianraspberry-piallegro5

Allegro 5 on Raspberry pi


I just started working on RPi. I'm writting a program which involves making photos (bmp files) and analyzing some pixels. I'm using allegro 5 library and i got a 'basic' problem with function al_load_bitmap. I'm unable to to load bitmap. First lines of code:

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include "allegro-5.1.8/build/lib/Headers/allegro5/allegro.h"
#include "allegro-5.1.8/build/lib/Headers/allegro5/allegro_image.h"

using namespace std;

int main () 
{
unsigned char r, g, b;
ALLEGRO_BITMAP  *tape_image ;

al_init();
al_init_image_addon();
al_init_iio_addon(); 


system("raspistill -o /home/pi/Praca/photo.bmp -t 1");

tape_image = al_load_bitmap("/home/pi/Praca/photo.bmp ");

if(!tape_image) {

cout << "Error! Couldn't load bitmap." <<endl;
getchar();
return 0; 
   } 
...

as you can see program is making bitmap and then i want to work with it. But program is unable to load bitmap. IDE is Geany 1.22 Compiler g++ -L/usr/local.lib -lallegro_main -lallegro_image -lallegro And i had to add also this $(pkg-config --libs allegro-5 allegro_main-5 allegro_image-5


Solution

  • You should add

    -e bmp
    

    to raspistill call line.