EnhonBryant 2014-07-23 07:49
浏览 2856

用c# 怎么实现图片格式转换 (主要是转换成Ico格式图片)

通过:savePic.Save(FileName ,System.Drawing.Imaging.ImageFormat.Icon)
转换成共后的图片不能使用

而通过下面的方法 转换后的图片虽然可以用但是明显发生了变化
private void ZhuangHuan(string sourcePath,string desPath)
{
using(Bitmap bitmap=new Bitmap(sourcePath))
{
using(Bitmap newBitmap=bitmap.Clone(new Rectangle(0,0,bitmap.Width,bitmap.Height),PixelFormat.Format24bppRgb))
{
using(Icon icon=Icon.FromHandle(newBitmap.GetHicon()))
{
FileStream fileStream = new FileStream(desPath, System.IO.FileMode.Create);
icon.Save(fileStream);
}
}
}

    }

有没有更好的办法??

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 一道python难题2
    • ¥15 一道python难题
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试
    • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
    • ¥15 教务系统账号被盗号如何追溯设备