Understanding bmp image files

Paul McGuire ptmcg at austin.rr.com
Wed Apr 2 18:08:12 EDT 2008


On Apr 2, 2:22 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> "pranav" <pra... at gmail.com> wrote in message
>
> news:2537c458-b4d5-480d-8407-168a2b59a27e at u10g2000prn.googlegroups.com...
> | Hello,
> | 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.
>
> I would look into PIL, PyGame, and Numeric/Numpy.

My mistake, for some reason I thought the OP wanted to read a BMP file
directly, and the code I cited shows the guts of writing out a BMP
file so he might get an idea about the file's structure - to address
the OP's actual question, I would second the recommendation to use PIL
to read, manipulate, and write back out the pixel values.

-- Paul



More information about the Python-list mailing list