how to show a bitmap?

Y

Yun Mao

Hi,
I have a two dimentional array (by Numeric Python) available, and it
represent a grayscaled bitmap picture. How to display it? Thank you!


Yun
 
D

Diez B. Roggisch

I have a two dimentional array (by Numeric Python) available, and it
represent a grayscaled bitmap picture. How to display it? Thank you!

You can use pygame.

Diez
 
D

Diez B. Roggisch

Yun said:
Could you please be a little more specific? ;)

Its well documented on www.pygame.org. You have to look into the module
surfarray, which makes it possible to access and manipulate pixel data
using - guess what - Numeric arrays.

Look in the code examples for some effects that utilize this - AFAIK there
is something like a fire or motion blurring. These access pixel data. Just
plug in your array, and you should be done.

Regards, Diez
 
D

Diez B. Roggisch

Look in the code examples for some effects that utilize this - AFAIK there
is something like a fire or motion blurring. These access pixel data. Just
plug in your array, and you should be done.

http://www.pygame.org/pcr/numpy_flames/index.php

This is the flames example. The function in question is blit_array - look it
up in the docs. This example even deals with indexed_bitmap_data, which is
what you want, as you have a only one value per pixel.

Regards,

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,476
Latest member
blackwatermelon

Latest Threads

Top