如何使用图像文件中的十六进制值来形成图像? [英] How the hex values in an image file is used to form an image?

查看:106
本文介绍了如何使用图像文件中的十六进制值来形成图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像中的像素是否代表不同的颜色,当以某种方式排列时会形成有意义的图像?如果图像的分辨率为500x500像素,那么这是否意味着图像文件中包含10000个十六进制值,每个十六进制值代表不同的颜色阴影?如何将颜色分配给特定的十六进制值?



当我在文件中输入一些随机十六进制值并保存在文件中时,是否有显示图像的工具任何众多的图像文件格式?

Does the pixels in the image represents different colors which when arranged in some manner forms a meaningful image? If an image has a resolution of 500x500 pixels then does that mean the image file has 10000 hex values in it with each hex values representing different shades of colors? How a color is assigned to a specific hex value?

Is there a tool which would display the image when I enter some random hex values in a file and save it in any of the numerous image file formats?

推荐答案

图像文件中各种十六进制值的含义完全取决于文件的格式。



不,500x500像素的图像可能不会有250,000个字节。图像数据可能是250,000字节,但可能更多或更少的机会是好的。这是因为在大多数图像格式中,每个字节将有多个像素,或者相反,每个像素有多个字节。



图像数据的字节数也将受到图像格式使用的任何压缩算法的影响,如果有任何质量设置。



还有一些数据不属于图片本身。



The meaning of the various hex values in an image file depends entirely on the format of the file.

No, a 500x500 pixel image is probably NOT going to have 250,000 bytes in it. It's possible that the image data may be 250,000 bytes, but chances are good that it may be more or less. This is because in most image formats you're going to have multiple pixels per byte or, the opposite, many bytes per pixel.

The number of bytes of image data will also be affected by any compression algorithm being used by the image format and if there are any quality settings for it.

There is also data that is not part of the image itself.

引用:

是否有工具可以显示图像当我在文件中输入一些随机十六进制值并将其保存为众多图像文件格式中的任何一种时?

Is there a tool which would display the image when I enter some random hex values in a file and save it in any of the numerous image file formats?



否,没有。做这样的事情是没有意义的。对于您选择的任何图像格式,随机放入文件的内容可能不是有效数据。


No, there isn't. It doesn't make sense to do something like this. What you "randomly" put into the file will probably not be valid data for whatever image format you chose.


图像中没有十六进制值。值不能是十进制或十六进制,它们是二进制的。 十进制或十六进制只能是表示数字的一些字符串,而不是数字本身。并且图像像素基于这些位。具体表示取决于像素格式;有很多。要了解相关信息,请阅读: https: //msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat%28v=vs.110%29.aspx [ ^ ]。



因此,您还没准备好使用图像位,像素等。首先,您需要清楚了解计算机的用途。不用担心,你会得到它的时间。只关注基本面,不要选择酷的东西。 :-)



-SA
There are no "hex values" in image. Values cannot be decimal or hexadecimal, they are binary. "Decimal" or "hexadecimal" could only be some strings representing numbers, but not numbers themselves. And the image pixels are based on those bits. The particular representation depends on such thing as "pixel format"; there are quite a few. To get an idea, please read: https://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat%28v=vs.110%29.aspx[^].

So, you are not ready to work with image bits, pixels, and so on. First of all, you need to get a clear idea on what computers do. Not to worry, you will get it with time. Just concentrate on fundamentals, don't go in for "cool" stuff. :-)

—SA


这篇关于如何使用图像文件中的十六进制值来形成图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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