- Joined
- Jun 25, 2007
- Messages
- 2
- Reaction score
- 0
I work in image processing program (Windows Application) and I have a problem in converting image from format to another.
The first problem
I converted the Image file to Icon through 2 ways but still have problems these 2 ways are:
1-
Bitmap icon =new Bitmap (ImagePath);
icon.Save(targetfilename, ImageFormat.Icon);
This way don't work correctly
2-
Bitmap bitmap = new Bitmap(ImagePath);
Icon ico = Icon.FromHandle(bitmap.GetHicon());
FileStream fs = new FileStream(targetfilename, FileMode.OpenOrCreate);
ico.Save(fs);
fs.Close();
This way make colors of the output icon change.
How can I convert this type?
The second problem:
When I convert to gif file as follow:
Bitmap bitmap = new Bitmap(ImagePath);
bitmap.Save(targetFileName, ImageFormat.Gif);
This way make low resolution, and if the source image doesnot have background, the output file will be with background in the converted formats (.Gif, .Bmp, .Jpeg)
How can I convert this type?
The third problem:
The formats Wmf, Exif, Emf donot have Encoder.
How can I convert them?
Please tell me wat is the wrong in my code
The first problem
I converted the Image file to Icon through 2 ways but still have problems these 2 ways are:
1-
Bitmap icon =new Bitmap (ImagePath);
icon.Save(targetfilename, ImageFormat.Icon);
This way don't work correctly
2-
Bitmap bitmap = new Bitmap(ImagePath);
Icon ico = Icon.FromHandle(bitmap.GetHicon());
FileStream fs = new FileStream(targetfilename, FileMode.OpenOrCreate);
ico.Save(fs);
fs.Close();
This way make colors of the output icon change.
How can I convert this type?
The second problem:
When I convert to gif file as follow:
Bitmap bitmap = new Bitmap(ImagePath);
bitmap.Save(targetFileName, ImageFormat.Gif);
This way make low resolution, and if the source image doesnot have background, the output file will be with background in the converted formats (.Gif, .Bmp, .Jpeg)
How can I convert this type?
The third problem:
The formats Wmf, Exif, Emf donot have Encoder.
How can I convert them?
Please tell me wat is the wrong in my code