Mobile app version of vmapp.org
Login or Join
Sims5801359

: Can I paint in numbers? I'm interested in creating a 2x2 array of values by painting it. After all, a 2D image is essential a data table. To clarify, I'd like to use some well known interface

@Sims5801359

Posted in: #DataVisualisation #ImageFormat #Images

I'm interested in creating a 2x2 array of values by painting it. After all, a 2D image is essential a data table.

To clarify, I'd like to use some well known interface like GIMP, to use a stylus to draw an image pixel by pixel, and export into some well known file format. What's crucial is being able to identify the numerical values that the colors correspond to, and then importing and recovering that data as a 2x2 array in Python or Matlab or whatever.

For example, could I use a 256 color gif to create an array whose values lie within [0,255]? If so, how would I identify which colors correspond to which values without sifting through tables of hexadecimal?

As an end goal, I'd like to paint using a "palette" of user-defined floats, but that seems tricky.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims5801359

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray976

Sure, this is possible. A colored pixel on a screen boils down to four numbers, r (red), g (green), b (blue), and a (alpha), ranging from 0 to 255 so computers can understand it anyway. So any image format would work.

You just need to research how to read color values in whatever programming language you're using, such as How can I read the RGB value of a given pixel in Python?

If you wanted it to use a single number, the simplest way would be to concatenate the RGB values together, so an example value might be 020020020 for rgb(20, 20, 20) (maybe adding 255 to the end if you want to include alpha).



Side note: Some steganography techniques actually use image formats to transfer data securely or hide hidden messages. It's similar to what you're seemingly attempting to do, you might investigate similar techniques to get more information on the subject.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme