我在Format24bppArgb 11MB中有一个10,000px到10,000px的jpeg图像,但是在克隆它并将其保存为Format32bppArgb中的bmp之后,它上升到500MB,无论是什么原因?
let file = new Bitmap("planet.jpg")
let rect = new Rectangle(0, 0, file.Width, file.Height)
let img = file.Clone(rect, PixelFormat.Format32bppArgb)
img.Save("copy.bmp", ImageFormat.Bmp)
答案 0 :(得分:0)
我继续在FSI中执行以下操作:
open System.Drawing
open System.Drawing.Imaging
let file = new Bitmap("planet.jpg")
let rect = new Rectangle(0, 0, file.Width, file.Height)
let img = file.Clone(rect, PixelFormat.Format32bppArgb)
img.Save("copy.bmp", ImageFormat.Bmp)
根据Windows资源管理器,我使用了一个空白的10,000px×10,000px JPG文件,时钟为1,563,127字节。结果copy.bmp
为400,000,054字节,这确实比输入大很多。
正如@PaulAbbott所说,这是因为位图文件中没有压缩。每像素32位的10,000×10,000图像最终将被存储为3,200,000,000位,这正好是400,000,000字节或大约400 MB - 大约是您发布的大小。
如果您的文件确实是500 MB而不是400 MB左右,您可以尝试在某处托管吗?我想看看它,看看我在这里遗漏了什么。