如何将Tiff图像字符串保存到.Tif文件或位图文件 [英] How Do I Save Tiff Image String To .Tif File Or Bitmap File

查看:129
本文介绍了如何将Tiff图像字符串保存到.Tif文件或位图文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我是WPF的新手,我需要将遗留系统与新的wpf系统集成。遗留系统将多页.tif文档读入一个字符串数组,每个字符串代表一个.tif图像/页面。我必须采取字符串数组并循环通过它将每个字符串转换为.tif文件或位图。请有人帮我。提前谢谢。

Hi everyone! i am new to WPF and i need to integrate a legacy system with a new wpf system. the legacy system reads a multipage .tif document into an array of strings each representing a single .tif image/page. i have to take the string array and loop through it converting each string to either .tif file or a bitmap. can anyone help me on that please. thanks in advance.

推荐答案

您可以使用类 System.Drawing.Bitmap 并从流中读取位图: http://msdn.microsoft.com/en-us/library /z7ha67kw%28v=vs.110%29.aspx [ ^ ]。



现在,什么流?它可以是一个内存流: http:// msdn .microsoft.com / zh-CN / library / system.io.memorystream%28v = vs.110%29.aspx [ ^ ]。



我不知道你的字符串中数据字节的确切含义,首先,你需要将你的字符串转换为 byte [] 数据。它可能只是一些8位编码,其中每个字符是8位并表示单个字节,那么您需要将这些字符复制到具有大小写的字节中。通常情况下, System.Text.Encoding 类负责从字符串中获取数据:

http://msdn.microsoft.com/en-us/library/ds4kkd55%28v=vs.110% 29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.text.encoding(v = vs.110).aspx [ ^ ]。



-SA
You can use the class System.Drawing.Bitmap and read the bitmap from stream: http://msdn.microsoft.com/en-us/library/z7ha67kw%28v=vs.110%29.aspx[^].

Now, what stream? It could be a memory stream: http://msdn.microsoft.com/en-us/library/system.io.memorystream%28v=vs.110%29.aspx[^].

I don't know how exactly the data bytes are represented in your string, so first, you need to convert your string to byte[] data. It could be just some 8-bit encoding where each character is 8-bit and represents a single byte, then you would need to copy such characters into bytes with a case. In general more case, the System.Text.Encoding classes are responsible for getting data from a string:
http://msdn.microsoft.com/en-us/library/ds4kkd55%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx[^].

—SA


这篇关于如何将Tiff图像字符串保存到.Tif文件或位图文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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