enthought / enthought/enable

Agg GraphicsContext doesn't seem to be properly converting pixel formats.

Open
#21 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
97
Forks
45
PR merge metrics
No merged PRs in 30d

Description

The following code example illustrates the problem:

```
from numpy import array, linspace, meshgrid, ones, uint8
from enthought.kiva.backend_image import GraphicsContext, Image

x,y = meshgrid(linspace(0.0, 1.0, 7), linspace(0.0, 1.0, 7))
z = (x*y*255).astype(uint8)
alpha = ones(z.shape, dtype=uint8) * 255
bmp_data = array((z,z,z,alpha)).T

img = GraphicsContext(bmp_data, pix_format="rgba32")
img.save("image.png")
gc = GraphicsContext((400,400), pix_format="rgba32")
gc.draw_image(img, (0, 0, 400, 400))
gc.save("rgba32.png")
```

https://svn.enthought.com/enthought/ticket/1293

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.