On Fri, Jun 1, 2012 at 7:06 AM, David Jones <
d...@pobox.com> wrote:
> On 21 May 2012 02:09, rovitotv <
rovi...@gmail.com> wrote:
>> Greetings,
>> I really like pypng it works very well for us when we use it to
>> create images from numpy. Now I want to read a image make some simple
>> manipulations then write it back out. Based of the exnumpy.py code
>> below is the code that I have. The results I see are very odd, it
>> looks like the color planes are out of whack and the result image is
>> the transpose of the original. For example if the original image was
>> 640 x 480 then the results image will be 480 x 640. The exnumpy.py
>> example runs perfectly but it is a square image and is uint16. I
>> wonder if somebody could take a look and give me a helping hand.
>> Thanks!
>
> asDirect returns (width,height,pixels,meta) therefore...
>
> this line:
> rowCount, columnCount, pngData, metaData = r.asDirect()
> should be:
> columnCount, rowCount, pngData, metaData = r.asDirect()
Yes, that fixed it!!!! I didn't read the documentation or perhaps
just foobar'ed the order of the parameters. Thanks
> Also in the nested for loops where you draw the diagonal line, you are
> indexing the first axis of the numpy array with a variable called 'x',
> but the first axis of the numpy array is the vertical axis in the PNG
> image data (and so would conventionally be called 'y'). Same for the
> 'y' variable, but swapped.
I see your point the way I wrote that loop was not very clear...
> I guess I should make that point clearer in the documentation.
I actually think the documentation is pretty good but perhaps a few
more examples? For me I can never have enough examples. Thanks for
the assistance I find pypng very useful and especially easy to
install.