Java中应该思路差不多。
static void Main(string[] args)
{
string picPath = @"D:\download\Pic.jpg";//Origin picture path as jpg
string destPath = @"D:\download\Pic2.bmp";//Destination picture as bmp(or any type u like)
Image img = Image.FromFile(picPath);//load origin picture
File.Create(destPath);//create dest picture as path u want
using(MemoryStream memStream=new MemoryStream())//create a instance of memorystream
{
img.Save(memStream, ImageFormat.Bmp);//save stream from origin pic as format bmp
Bitmap destBmp = new Bitmap(memStream);//create bmp instance from stream above
destBmp.Save(destPath);//save bmp to the path you want
}
Console.WriteLine("**********Done**************");
Console.ReadKey();
}
C#实现jpg转MemoryStream,再转成bmp保存
答案:4 悬赏:0 手机版
解决时间 2021-03-15 09:50
- 提问者网友:雪舞兮
- 2021-03-14 10:01
最佳答案
- 五星知识达人网友:孤独入客枕
- 2021-03-14 10:35
兄弟,没有看懂哦
全部回答
- 1楼网友:患得患失的劫
- 2021-03-14 14:22
这代码应该可以用,你要问什么?
- 2楼网友:西风乍起
- 2021-03-14 13:33
这段代码有问题吗?
- 3楼网友:鸽屿
- 2021-03-14 12:01
using system.io;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯