matploblib communication problem, graphics question


W

_wolf

i've had a hard time today to drill down on some infos
about matplotlib of http://matplotlib.sourceforge.net/.
this is an sf.net-managed project, its mailing lists are
managed by <shudder/> gnu mailman in a pre-1994 version.

still there is a sf.net standard forum interface, which
however denies me to post. i've set up an account on
sourceforge---not an experience i need; boarding an
intercontinental flight is swift in comparison.

but having an account on sf.net is not enough to post to
a mailing list there, so i filled out a second longish
form to subscribe to the list thru the <horrors/>
mailman interface. i had to re-enter my email address.

now what is left to me is to try writing directly to
(e-mail address removed) and then scoop
it up on http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users

as it is so incredibly hard to make oneself heard on
the matplotlib list, i realized that questions from
outsiders are maybe not welcome, so i do a cross-post
to reach more audience.

i need to do some raster-image scaling and i've been
hunting hi and lo for a python library that can do that.
so far choices are (in order of perceived aptness)::

imagemagick of old,

pythonware.com/products/pil,

antigrain.com,

matplotlib,

cairo of cairographics.org.

Cairo is definitely may favorite here. i know with
certainty that cairo is good at scaling images, as
firefox3 is using it to achieve a smoothness and
readability in scaled images that rivals the quality
of safari’s.

but i have been unable to uncover any information
about raster-image scaling in cairo---can’t be, right?
an open source project that becomes part of firefox3
and i can’t find out how to use their flagship
functionality?

so i went to matplotlib. i now have these methods to
open image files with matplotlib::

def get_image_jpg():
import Image
from pylab import *
import numpy
print dir( numpy )
from numpy import int8, uint8
# these lines are incredible -- just open that damn jpg. can be as
simple as `load(route)` -- ALL the pertinent
# information well be in time derived from the route and the
routed resource structure (the router, and the
# routee). pls someone giveme a `MATPLOBLIB.read()`, a
`MATPLOBLIB.load()`, or a `MATPLOBLIB.get()` already.
image = Image.open( image_locator )
rgb = fromstring( image.tostring(), uint8 ).astype( float ) /
255.0
# rgb = resize( rgb,( image.size[ 1 ], image.size[ 0 ], 3 ) )
rgb = resize( rgb,( 100, 150, 3 ) )
imshow( rgb, interpolation = 'nearest' )
axis( 'off' ) # don’tdisplaytheimageaxis
show()

def get_image_png( image_locator ):
from pylab import imread as _read_png
from pylab import imshow as _show_image
from pylab import gray
from pylab import mean
a = imread( image_locator )
#generates a RGB image, so do
aa=mean(a,2) # to get a 2-D array
imshow(aa)
gray()

quite incredible, right? it can somehow be done, but
chances are you drown in an avalanche of boiler plate.
and sorry for the shoddy code, i copied it from their
website.

so they use pil to open an image file. pil’s image
scaling is 1994, and the package is hardly maintained
and not open. yuck. whenever you have a question
about imaging in python people say ‘pill’ like they
have swallowed one.

let’s face it, pil is a bad choice to do graphics.
here i did install pil, because matplotlib seemed to
be basically handling raster-images and image
transformations.

the matplotlib people have the nerve to put a short
doc to their root namespace items, as are, `axhspan`,
`cla`, `gcf`, and such more. this interface is
hardly usable. it shouldn’t be that hard to open an
image file in an image manipulation library. nobody
wants to maintain that kind of sphpaghetti.

i haven’t been succesful so far to find out how to
scale an image in cairo or matlotlib, or an other
alternative. please don’t sugggest doing it with
pil or imagemagick, i won’t answer.

is there any coherent python imaging interest group
out there? can i do it with pyglet maybe?

cheers & ~flow
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top