images in SVG

One problem with the colorbar is that the png file

    > "im.write_png (filename)" creates is upside down,
    > image_demo.py creates an upside down png too.

    > I see that the GTK/GDK backend does not use im.write_png()
    > but uses im.as_str() which has a 'flipud' argument to flip
    > the image. Is it possible for im.write_png() to take the
    > 'flipud' argument and flip the image for the SVG backend?

I started working on this, but then realized I would also need to add
it to buffer_argb32, buffer_rgba and so on, and that is was much
cleaner to simply add an im.flipud() method than implement it in all
the conversion and write methods.

I just committed changes with these fixes and updated backend_ps and
backend_svg to use them. images in svg appear to be working fine now,
and the origin = 'lower'|'upper' is respected.

    > The name im.as_str() is a bit vague - what kind of string?
    > Something like im.as_rgba_str() would make it a bit
    > clearer.

Done.

JDH

Its good that this fixes the problem, but I don't see why flipping an
image upside down should also change its size. There's probably still a
bug in there somewhere, but its not too important if the SVG images look
correct now.

The SVG backend is also useful for debugging because it gives you a text
list of everything the frontend does. For example I can look at the
output of './simple_plot.py -dSVG' and see that the frontend seems to
have a bug where its drawing every tickline twice. I had a look at
axis.py but could not work out what was going on.

Steve

Send instant messages to your online friends http://au.messenger.yahoo.com

···

On Wed, 2005-08-03 at 10:27 -0500, John Hunter wrote:

    > One problem with the colorbar is that the png file
    > "im.write_png (filename)" creates is upside down,
    > image_demo.py creates an upside down png too.

    > I see that the GTK/GDK backend does not use im.write_png()
    > but uses im.as_str() which has a 'flipud' argument to flip
    > the image. Is it possible for im.write_png() to take the
    > 'flipud' argument and flip the image for the SVG backend?

I started working on this, but then realized I would also need to add
it to buffer_argb32, buffer_rgba and so on, and that is was much
cleaner to simply add an im.flipud() method than implement it in all
the conversion and write methods.

I just committed changes with these fixes and updated backend_ps and
backend_svg to use them. images in svg appear to be working fine now,
and the origin = 'lower'|'upper' is respected.

    > The name im.as_str() is a bit vague - what kind of string?
    > Something like im.as_rgba_str() would make it a bit
    > clearer.

Done.

JDH