Hi,

I'm a beginner on the python-win32 field, so please excuse stupid questions ;-)

We have an vb application that uses a python com server. This python
module generates images in a stringio object. We want to pass the
image as a string / stream to the vb application. This is in a way
working, as we get the data in vb, but the image cannot be rendered
there due to an exception from system.drawing.dll "invalid parameter
used".

The server has a drawing method the returns the image from a stringio
via getvalue().
The relevant vb code, that should take the string and show it in an
image object:

Dim bSPil As Object = CreateObject("Python.BSPil")
Dim imageString As String
imageString = bSPil.return_image()
Dim imageBytes() As Byte = (New UTF8Encoding()).GetBytes(imageString)
Dim ms As New IO.MemoryStream(imageBytes)
pb1.Image = System.Drawing.Image.FromStream(ms)

The error is raised at the last line. When saving the image from
python to a file and reading it as a filestream in vb, the image is
displayed correctly. Can anybody shed some light on this.

Thanks, Michael

-- 
-----------------------------------------------------------
Michael Schulz
[EMAIL PROTECTED]
-----------------------------------------------------------
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to