I use matplotlib and Backend Agg to draw a plot , I want to show this plot in my GUI in specific area (Plot area) , I need to have the image object in oder to show it, so I have to convert this plot to string or array or save in buffer and then load it to an Image , I want to know , can I accomplish this without using PIL , because I need to build, test and verify any new package added to the system on 6 different platforms, and it might take a long time and at high expertise level to add the module to our entire system.
What I have to do? I can convert it to string or array with numpy or FigureCanvas or ect. , my problem is how to load this array or string to image ! Is it clear? Anthony Floyd-2 wrote: > > Forgot to reply-to-list... > > ---------- Forwarded message ---------- > From: Anthony Floyd <[EMAIL PROTECTED]> > Date: Wed, Mar 26, 2008 at 4:54 PM > Subject: Re: [Matplotlib-users] load data from string or array to Image > To: sa6113 <[EMAIL PROTECTED]> > > > On Wed, Mar 26, 2008 at 1:33 AM, sa6113 <[EMAIL PROTECTED]> wrote: > > > > > > I have a problem to load data from string or array to Image but > without > > using PIL , because I have to check the application in 6 different > platforms > > like Windows 32bit, Windows X64 (64bit version), Linux 32bit, Linux > 64bit > > x86_64, Linux IPF (Itanium Processor Family) and HP-UX 64. > > > > There is a code but I don't want to use PIL : > > http://mail.python.org/pipermail/image-sig/1998-October/000572.html > > > > Can I accomplish the same thing using the modules that are already on > the > > system, or those that are pure Python (not requiring any compilation > or > > binary download)? > > I went through this just a few weeks ago. Now, mind you I'm using wx > and numpy already. > > My solution was to turn my .png into a Python string using img2py.py > in the wx/tools directory. > > With the string, I then used the following code to return the image (a > watermark) as an array that figimage() or imshow() can use directly. > I'm sure the code can be optimized, but it works fast enough for me... > > def getWatermarkArray(): > rows = 28 > columns = 200 > dimensions = 3 > > image = getWatermarkImage() > # image array is a string of hex values > imageString = image.GetData() > > imageList = [ord(item) for item in imageString] > > imageArray = numpy.zeros(shape=(28,200,3), dtype=numpy.float32) > > imageCounter = 0 > > for rowCounter in range(rows): > for columnCounter in range(columns): > for dimCounter in range(dimensions): > imageArray[rowCounter][columnCounter][dimCounter] = > imageList[imageCounter]/255. > imageCounter += 1 > > return imageArray > > HTH, > A> > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/load-data-from-string-or-array-to-Image-tp16297653p16322508.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users