Understanding bmp image files
ptmcg at austin.rr.com
Wed Apr 2 14:05:49 EDT 2008
On Apr 2, 12:51 pm, pranav <pra... at gmail.com> wrote:
> I want to read a BMP file, do some processing and then write it in a
> new file. The problem is in the third step. For reading the file, i
> have converted the file into decimal numbers, representing the pixel
> values. Then i perform calculations on those decimal numbers. Now i am
> unable to convert those into the format as required by the "bmp" file.
> Any one, who is into image reading/manipulation, please help.
Here is a link to a *very* crude BMP file utility I wrote a long time
ago. (http://www.geocities.com/ptmcg/python/index.html#bmp) Follow
the highlighted "module" link to see the underlying code - there are
methods for saving the BMP data to a file. Perhaps those samples
might give you some insight on what is required.
(I would probably rewrite this to use the struct module nowadays, but
this code works as is.)
More information about the Python-list