No, I haven't tried this approach, but am sure there must be something
else going wrong. Why else would jpg and gif go ok? My challenge is,
however, to take a bunch of different image files, and construct my
own native fileformat where all those original files are embedded
inside my new file. i have solved this by using a binarystream, saving
the number of pictures, and then for each picture, save type ("bmp",
"gif" etc), size in bytes, and the image.
- Peder -
Marcin Grz?bski <mg*******@taxussi.no.com.spam.pl> wrote in message news:<ci**********@atlantis.news.tpi.pl>...
Hi,
I've never any problem with BMP's saving.
Did you try to remove "BinaryWriter" and save it
only by:
FileStream fStream=FileStream("filename", FileMode.Create,
FileAccess.Write);
try {
img.Save(fStream, ImageFormat.Bmp);
}
finally {
fStream.Close();
}
Did you get any exception in your case?
Regards
Marcin
My code is something like this:
---------------
Image img = Image.FromFile("somefile.bmp");
FileStream fStream = new FileStream("someBinaryFile.dat");
BinaryWriter bw = new BinaryWriter(fStream);
img.Save(bw.BaseStream, ImageFormat.Bmp);
bw.Close();
fStream.Close();
---------------
When I display the bw.BaseStream.Position before and after the save
operation, it appears to go backwards! Saving Gif's and jpg's works.
Anyone got an idea? Thanks!
- Peder -