copying a string???

Michael Hudson mwh at python.net
Thu Aug 22 10:07:05 EDT 2002


Joe Connellan <joec at mill.co.uk> writes:

> The string I pass to changeString() represents an 8 bit image for
> processing. The images I am processing are very large so it is more
> efficient for my function to change the pixel values of the input image
> rather than allocating enough memory for an output image to write into. I
> need to display before and after images once the processing is done - at
> the moment my before image changes with the after.
> 
> If I shouldn't be changing the string, do you know of a better way of
> going about it? - I do need the image data to be stored as a string - for
> PIL and PyOpenGL reasons, and I can't afford to allocate memory for more
> than one image at a time.

Use an byte array?  It probably can be used in place of a string as
far as PIL & PyOpenGL are concerned.

    http://www.python.org/doc/lib/module-array.html

Cheers,
M.

-- 
  I saw `cout' being shifted "Hello world" times to the left and
  stopped right there.                                -- Steve Gonedes



More information about the Python-list mailing list