C#保存巨大的图像 [英] C# Saving huge images

查看:146
本文介绍了C#保存巨大的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用C#保存大图像时遇到了困难(我说的是超过一千兆字节)。

I'm having difficulties when trying to save huge images with C# (I'm talking about over one gigabyte).

基本上我试图在部分中执行此操作 - 我有大约200个位图源,我需要一种方法在将它们编码为.png文件之前或之后将它们组合。

Basically I'm trying to do this in parts - I have around 200 bitmap sources and I need a way to combine them before or after encoding them to a .png file.

我知道这需要大量的RAM,除非我以某种方式直接从硬盘驱动器传输数据,但我也不知道如何做到这一点。

I know this is going to require lots of RAM unless I somehow stream the data directly from hard drive but I have no idea how to do this either.

每个位图源都是895x895像素,因此在编码后合并图像似乎并不容易,因为C#不允许您创建大小为13425 x 13425的位图。

Each bitmap source is 895x895 pixels so combining the images after encoding doesn't seem easy because C# doesn't let you create a bitmap with size of 13425 x 13425.

推荐答案

PngCs库(免责声明:我是作者)让您逐行读取和写入巨大的PNG图像,这样您就不需要将完整的图像保存在内存中;也许你发现它很有用。

This PngCs library (disclaimer: I'm the author) lets you read and write huge PNG images line by line, so that you don't need to keep the full image in memory; perhaps you find it useful.

这篇关于C#保存巨大的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆