在 PNG 中使用块
我正在寻找一种方法来获取和设置 PNG 文件中的那些奇怪的块,即在我的例子中,“zTXt”块。 .Net 框架或任何其他已知的程序集中是否有任何内置内容可以提供对这些数据的访问? 如果已经完成的话,我想避免为此目的编写整个 PNG 读取器/编写器。
谢谢你!
进度更新: 经过更多搜索后,似乎没有任何东西可以满足我想要完成的任务。 我现在尝试自己阅读该文件,但在处理数据的压缩部分时遇到问题。 我在这里针对这个特定问题提出了另一个问题:如何在文件的一部分上使用 DeflateStream?
一旦我开始工作,我将在此处发布代码作为答案。 (当然,除非有人比我先一步。)
I'm looking for a way to get and set those oddball chunks in a PNG file, namely in my case, the 'zTXt' chunk. Is there anything built into the .Net framework, or any other known assembly, that provides access this data? I'd like to avoid having to write an entire PNG reader/writer for this purpose if it has already been done.
Thank you!
Progress update:
After more searching, there appears to be nothing pre-made for what I want to accomplish. I'm attempting to read through the file myself now, but am having trouble with the compressed part of the data. I've asked another question for this particular issue here: How do you use a DeflateStream on part of a file?
Once I get this working, I'll post the code here as an answer myself. (Unless someone else beats me to it of course.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下应该有效:
http://sourceforge.net/projects/pngnet/
使用 Subversion 进行检查。
它是一个用于低级访问 png 文件的库和一个小型 C# 示例。
The following should work:
http://sourceforge.net/projects/pngnet/
Check it out using Subversion.
It's a library for low-level access to png files and a small C# example.
它必须是.net吗? 下面是一些 Ruby 代码,用于读取这些块并再次将它们写回。 在中间插入您的处理
Does it have to be .net? Here's some ruby code to read through the chunks and write them back out again. Insert your processing in the middle
这是完全用 Java 编写的代码,用于读取整个内容巴布亚新几内亚。 它很小,你应该能够挑选你需要的东西。
我认为翻译 c# 会相当简单
Here's the code neatly in Java to read an entire PNG. It's pretty small and you should be able to cherry pick what you need.
I would think translating the it c# would be reasonably simple