diegorep / pypng

Automatically exported from code.google.com/p/pypng
0 stars 0 forks source link

Clients cannot choose array typecode easily. #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When client code uses PyPNG to extract pixel data from a PNG file they may want 
to process it in 
intermediate datastructures.  It can be convenient to use an array for this.  
The client needs to pick 
the typecode for the array, but PyPNG does not make this particularly easy.

Client's are forced to use this slightly ugly hack:

typecode = 'BH'[info['bitdepth'] > 8]

This is a little bit crazy, because PyPNG already knows this.  It should just 
make it conveniently 
available (in the info dict for example).

Original issue reported on code.google.com by d...@pobox.com on 1 Apr 2009 at 8:20

GoogleCodeExporter commented 8 years ago
Also an issue for NumPy integration.  NumPy users will also want to select a 
suitable array type, but in their case 
it will be between numpy.uint8 and numpy.uint16 (probably).

Original comment by d...@pobox.com on 17 Apr 2009 at 8:50