Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
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?
Posted
Updated 10-Jul-15 10:21am
v2
Comments
Michael_Davies 10-Jul-15 16:21pm    
A lot depends on which image format used, you can find plenty of information on the various file formats used to store images if you use Google, pick one and read on.

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.

Quote:
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.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 11-Jul-15 0:00am    
First thing to address is to eliminate such notions as "hex values". There is no such thing. Please see Solution 2.
—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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900