in reply to create image via binmode

You are reading the file using a textfile-oriented function (I believe the buzzword is "starship operator" but I could have that wrong). If you instead use the read() function and specify a binary record size, you should get the results you're looking for. The following code snippet is designed to read a file upload from the CGI standard input device and write it to a local disk file, but it shows the technique enough for you to modify it to read from an actual disk-resident file.
$inpfsz = 0; open(RESFIL, ">$desfnm"); binmode(RESFIL); while ($inpcnt=read($srcfnm,$inpbuf,2096)) { $inpfsz += $inpcnt; print RESFIL $inpbuf; } close(RESFIL);
- Steven K. Mariner Perl Lover