当您使用文本编辑器打开图像文件时,有没有办法解释文本编辑器显示的字符?

发布于 2024-10-30 15:56:38 字数 299 浏览 1 评论 0原文

我正在做一个研究项目,我使用文本编辑器(例如 Mac 上的 TextEdit)打开图像(BMP、JPG、CR2),然后通过在文档正文中复制和粘贴代码块并删除来操作代码某些部分,并将其替换为其他角色,所有动作都是随机的。通过这些实验,我得到了图像中的某些视觉扭曲。

这是一个艺术项目,但是我想知道是否有一种方法可以告诉乱码字符在特定信息方面代表什么,以及任何有经验的程序员是否可以轻松地解释这些信息。是否有一种“正确”的方式来显示图像代码以便以更有意义的方式操作它?有什么在线资源我可以查看吗?

我本质上不是程序员,但我对代码如何控制视觉输出非常感兴趣。

I am doing a research project where I open an image (BMP, JPG, CR2) with a text editor (such as TextEdit on a Mac) and I manipulate the code by copying and pasting code blocks within the body of the document, and removing certain parts, and substituting them for other characters, all random actions. I get certain visual distortions in the image by doing these experiments.

This is an art project, however I wanted to know if there is a way to tell what the gibberish characters are representing in terms of particular information, and whether it is easy for any experienced programmer to interpret this information. Is there a "proper" way of displaying image code in order to manipulate it in a more meaningful way? Are there any online resources I can look at?

I am not a programmer by nature, but I am very interested in how code governs visual output.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声静候 2024-11-06 15:56:38

好吧,“正确的方法”被称为图像查看器...

也许更有用的答案如下:未压缩的 BMP 文件中的大部分信息是数字的三元组,其中列出了像素的红色、绿色和蓝色分量按顺序(顶部还有一些信息说明文件有多大等)

如果您想查看文本中的数字,您可以考虑将图像转换为 PPM 格式(“便携式像素图”) ,它有一个基于文本的选项,更易于人类阅读。说实话,我不确定你会从中得到什么。请参阅 http://en.wikipedia.org/wiki/Netpbm_format

这看起来像乱码的原因文本编辑器的特点是基本文本存储为 7 位 ASCII,每个基本字母、数字或标点符号存储一个 0 到 127 之间的数字。字节可以保存 0 到 255 之间的数字,因此您看到的文件中的许多字节不会映射到“普通字符”。现在,有许多不同的方法可以解释像这样的更大的数字(如果您有兴趣查找 Unicode),但无论发生什么,您都可能会得到如您所见的混乱的废话。

JPG 格式(或 PNG 等)的图像具有更聪明的格式,可以更有效地存储信息。但是字节和像素之间没有这样的直接联系,因此不清楚您到底想在上面的描述中看到什么。

Well, the "proper way" is called an image viewer...

Maybe a more helpful answer is the following: most of the information in an uncompressed BMP file is triples of numbers which list the red, green, and blue components of the pixels in order (there's also a little bit of information at the top saying how big the file is etc.)

If you'd like to see the numbers in text, you could look into converting the images into PPM format ("portable pixmap"), which has a text-based option that's more human-readable. I'm not sure what you'd get out of it to be honest though. See http://en.wikipedia.org/wiki/Netpbm_format

The reason this looks like gibberish in a text editor is that basic text is stored as 7-bit ASCII, which stores a number between 0 and 127 for each basic letter, number or punctuation character. Bytes can hold numbers between 0 and 255, so lots of the bytes in the file that you see don't get mapped to "normal characters". Now, there are many different ways to interpret larger numbers like this (if you're interested look up Unicode), but whatever happens, you're likely to get mangled nonsense as you see.

Images in JPG format (or PNGs etc.) have a much cleverer format, which allows more efficient storage of the information. But there isn't such a direct link between bytes and pixels, so it's unclear what exactly you'd want to see in your description above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文