Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Using the "grabber" tool

This thread is locked; no one can reply to it. rss feed Print
Using the "grabber" tool
Dext3r
Member #13,007
July 2011

So, I recently started using the "grabber" tool in Allegro for datafiles, and I noticed when I picked out a picture (I had two), both of these pictures colors were completely washed out and had random deformed colors coloring them. I picked out the 256 color mode, but that appeared to have no effect.

Am I missing some kind of configuration that is necessary in order to make this work?

To clarify, I had to figure out how to compile allegro on my own, because I was using it with codeblocks and the installation that I tried to setup with commands in console didn't work, so I eventually got it to work another way.

However I found and downloaded the grabber tool separately, if that has anything to do with this (I was able to successfully create datafiles with this tool, the colors were just all screwed up.

Can someone help me with this?

Thanks,

Dext3r

North~
Member #12,192
August 2010

Were the colors screwed up during runtime? or in the grabber. If it's after you run the program, you may not be setting the color depth correctly. This always causes issues in my programs if I don't do it. set_color_depth(int)

--------------------------------------------------
http://blog.wolfire.com/2009/04/always-initialize-your-memory/

If this is possible if you don't correctly initialize memory, it should be a priority of the highest order.

james_lohr
Member #1,947
February 2002

It's almost certainly a palette issue. I think (though I may be recalling this incorrectly) that the grabber separates the bitmap data from the palette data, so you need to save and load the correct palette separately for 8-bit images.

Johan Halmén
Member #1,550
September 2001

A 256 colour image file contains the palette and the image data. In Grabber you create one instance which is the image (BMP), and one instance which is the palette (PAL). Then, for the BMP instance you grab the image file. And for the PAL instance you grab the same image file. The BMP instance holds only image data and the PAL instance holds only the palette data. In Grabber you see the image as a preview or thumbnail when you click at the BMP instance. But the colours might be weird. If you double click at the PAL instance, Grabber loads it and after that it shows all 8 bit BMP instnces using that palette.

In your program, when you use your DATAFILE, you get similarly one instance which holds the image data and another instance that holds the palette. In 8 bit mode you have to set the palette before showing the bitmap. In full colour mode you still have to connect your 8 bit image instance with the proper palette instance.

If you dont particularly want to work with 256 colours, convert all images to 24 bit or 32 bit before reading them into Grabber. This way you get rid of all palette problems.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Go to: