saving a wx.Image into memory and not file

Can wx.Image be saved somehow into memory so that the data can be sent over a network using base64 encoding?
For example, a client has to send a smaller version of an image to a server that does not have wxPython.
What I am doing now is this:

  1. client makes an image out of a file
  2. resizes it
  3. saves it into a file
  4. reads the image file
  5. encodes the image data into base64 and send it to the server
  6. server decodes the data and stores it in a file (without even knowing that it’s an image)

Is it possible to somehow skip steps 4 & 5? The reason why I am
asking is that potentially the client will not have a permission to
write to the disk.
Thanks in advance for any ideas.

Ratko