Re: [Image-SIG] Converting a binary file to ascii

2008-09-03 Thread Ashish Sethi
> Please define more precisely what you mean with "equivalent ascii > string". Strictly speaking, b2a_uu produces an equivalent string in the > sense that running a2b_uu gives you the original string back, but this > is obviously not what you want. In other words, there is 1:1 mapping > between arb

Re: [Image-SIG] Converting a binary file to ascii

2008-09-03 Thread abel deuring
On 03.09.2008 11:10, Ashish Sethi wrote: > I have PPM-P6 image file which is in binary format .The file is of the type > :- > > P6 > 128 128 > 255 > ߢ…ä£{ä¡~ߟxÞ¡yàšfß›lÜšyâ›jåŸhæ¦ué­yê§vé¡pÛš»ubž^Y¦f](c)g ..and so > on. > > How can i read the 4th line (binary) and convert it to an e

Re: [Image-SIG] Converting a binary file to ascii

2008-09-03 Thread Ned Batchelder
Since you are on Windows, you need to provide the "rb" mode to open, or it will convert newline characters in your file, which can trash your binary data. Also, I don't understand what b2a_uu does, but the docs say its input string should be at most 45 characters, so it doesn't seem like what

Re: [Image-SIG] Converting a binary file to ascii

2008-09-03 Thread Karsten Hiddemann
Ashish Sethi schrieb: How can i read the 4th line (binary) and convert it to an equivalent ascii string. [...] This script gave me some random absurd data as output. Have you tried using d=infile.read() to really read in *all* the remaining data from the file? ___