Wayne Watson wrote:
I didn't know I could post, attach I guess, here. I'll do that later.

 as long as it's a small file -- it can be much easier to help

There is one puzzling format difficulty I have with the file that requires some attention. I hope to have that cleared up in the next hour or two. Actually, there's a twist in the format that should be mentioned. The first image (frame) is 640x480, and I'm pretty sure one byte per pixel. However, every other image (frame) after that is 128 pixels square. An auxiliary text file provides where, x and y pixel position, the small image should be pasted to form a complete image with the 640x480 frame.

Maybe it's because I"m more familiar with numpy than PIL, but this is how I'd do that (untested, of course...):

import numpy as np

infile = file('filename')

img = np.fromfile(infile, count=640*480, dtype=np.uint8)


for i in range(num_images):
    do_something
    small_image = np.fromfile(infile, count=128*128, dtype=np.uint8)
    img[x:x+128, y:y+128] = small_image
    ....

NOTE: np.histogram2d might do what you want for the histogram


I'm sure you can do somethign similar directly with PIL.

-Chris








--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to