O
Olaf Baeyens
I want to convert one bitmap file to another one.
For example load as bmp and save as jpg.
The loading part is simple I do this:
Stream BitmapStream =
File.Open(sSrcFile,FileMode.Open,FileAccess.Read,FileShare.None);
Bitmap imgPhoto=new Bitmap(BitmapStream);
iPixelsX=imgPhoto.Width;
iPixelsY=imgPhoto.Height;
BitmapStream.Close();
The saving will be something like this; but I fail to see how I can hook up
imgPhoto from the load to this stream.:
Stream DestBitmapStream =
File.Open(DstFile,FileMode.CreateNew,FileAccess.Write,FileShare.None);
// how do I connect imgPhoto?
DestBitmapStream.Close();
Also I wonder if the Pixelfomat is different, lest say I load 8 bit indexed
color palette bitmap and want to save as 24 bit RGB jpeg, could this be done
automatic?
Something tells me that I need to copy the bytes manually??? I hope not.
Many thanks.
Olaf
For example load as bmp and save as jpg.
The loading part is simple I do this:
Stream BitmapStream =
File.Open(sSrcFile,FileMode.Open,FileAccess.Read,FileShare.None);
Bitmap imgPhoto=new Bitmap(BitmapStream);
iPixelsX=imgPhoto.Width;
iPixelsY=imgPhoto.Height;
BitmapStream.Close();
The saving will be something like this; but I fail to see how I can hook up
imgPhoto from the load to this stream.:
Stream DestBitmapStream =
File.Open(DstFile,FileMode.CreateNew,FileAccess.Write,FileShare.None);
// how do I connect imgPhoto?
DestBitmapStream.Close();
Also I wonder if the Pixelfomat is different, lest say I load 8 bit indexed
color palette bitmap and want to save as 24 bit RGB jpeg, could this be done
automatic?
Something tells me that I need to copy the bytes manually??? I hope not.
Many thanks.
Olaf