On Monday 30 July 2001 08:47 am, you wrote: > Guy, > > this works! thanks a lot. > > can you explain? > > > T> outfile = File.new("title_main.gif","w") > > > > Are you on an DOS system ? > > > > If yes, try > > > > outfile = File.new("title_main.gif","wb") What you're seeing is the result of a couple of two-decade-old bad design decisions. MS-DOS-derived systems (including, sadly, Windows/NT) will, by default, interpret certain bytes in your data. Notably, they'll expand LF ("\x0a") bytes into the two-character sequence "\x0d\x0a", and they'll terminate a stream upon seeing a ^Z ("\x1a") byte. A little bit of history here: Win(9x) is MS-DOS. Windows/NT copied Win9x conventions. When MS-DOS first came out, it didn't keep a byte count in its directory entries. You could tell how many disk blocks a file was, but not how many bytes. So they used a convention of marking the ends of text files with ^Z characters (as CP/M had done in the past). And they used (as had CP/M) two-character sequences for their line endings. -- Ned Konz currently: Stanwood, WA email: ned / bike-nomad.com homepage: http://bike-nomad.com