how load data to Image from String?

Would you please help me ?
I want to load data to Image (QImage) from String or binary String without
using PIL module .

···


View this message in context: http://www.nabble.com/how-load-data-to-Image-from-String--tp15784115p15784115.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

sa6113 wrote:

Would you please help me ?
I want to load data to Image (QImage) from String or binary String without
using PIL module .

you can load data straight into a numpy array with numpy.fromstring() -- if it's in an easy format (RGB, RGBA), then you should be able to go from there.

What do you want to do with the image data?

-CHB

···

--
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.Barker@...259...

Is there anyway to use the modules that are already on the system, or those
that are pure Python ?
I want to show a plot that draws with backend agg in my GUI , I mean in a
specified place that its type is Qlabel or QFrame , I don't want to save the
plot befor show it.

Christopher Barker wrote:

···

sa6113 wrote:

Would you please help me ?
I want to load data to Image (QImage) from String or binary String
without
using PIL module .

you can load data straight into a numpy array with numpy.fromstring() --
if it's in an easy format (RGB, RGBA), then you should be able to go
from there.

What do you want to do with the image data?

-CHB

--
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.Barker@...259...

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/how-load-data-to-Image-from-String--tp15784115p15820587.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

How use numpy in order to create Image object from string ?
.
.
.
size = canvas.get_width_height( )
buffer = canvas.tostring_rgb()
img = numpy.empty(size,numpy.uint32)
img = numpy.fromstring(buffer,numpy.uint32)

img is an array , but I want an Image object (without using PIL ).

sa6113 wrote:

···

Would you please help me ?
I want to load data to Image (QImage) from String or binary String without
using PIL module .

--
View this message in context: http://www.nabble.com/how-load-data-to-Image-from-String--tp15784115p15822415.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

I need QImage in order to display or use in GUI , for exa. in QFrame or
QLabel , I can convert the Image to QImage , but the problem is that I
haven't access to Image object without saving that , also I can convert the
figure (Plot) to string or buffer but I don't know what should I do after
that and how convert it to Image.

What about numpy or Numerical Python , may I use fromstring or another
function ?
Or what about savining the string binary or buffer in StringIO and then
convert to QImage ?

Christopher Barker wrote:

···

sa6113 wrote:

Would you please help me ?
I want to load data to Image (QImage) from String or binary String
without
using PIL module .

you can load data straight into a numpy array with numpy.fromstring() --
if it's in an easy format (RGB, RGBA), then you should be able to go
from there.

What do you want to do with the image data?

-CHB

--
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.Barker@...259...

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/how-load-data-to-Image-from-String--tp15784115p15843273.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

sa6113 wrote:

I need QImage in order to display or use in GUI , for exa. in QFrame or
QLabel , I can convert the Image to QImage , but the problem is that I
haven't access to Image object without saving that , also I can convert the
figure (Plot) to string or buffer but I don't know what should I do after
that and how convert it to Image.

I'm going to try one more time -- I actually answered all this in my last note:

1) you may not need to do this yourself at all -- look at the embedding in QT examples -- they show you how to embed MPL plots in a regular old QT application.

This may help:
http://www.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer

or this:
http://www.krugle.org/examples/p-WiYT16ZpEKzLv4fa/embedding_in_qt.py
(that should be in the MPL distro too)

2) If you really do need to convert the binary image data from MPL into a QImage, then you may be able to figure out how by looking at the QT backend code. If that doesn't work, then this is a question for the PyQT docs or mailing list.

-CHB

···

--
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.Barker@...259...