Add a way to grab RGB colors from roblox image assets

As a Roblox developer, it is currently impossible to get pixels and pixel colors from roblox image assets without using HTTP service or any third-party tools.

A simple :GetPixel(x,y) function for images would also be useful for generating terrain from height and material map images. Currently you need to either use HTTPService, or an external program (e.g. python script) to write out your bitmap as a lua array you can paste into a script. It would definitely be a time saver to be able to sample pixels off of an image in roblox.

Another thing that came to mind was raycasting. Imagine if rays could get Decal and Texture colors. Though I don’t really have a use for this, it would still be a neat feature to have and may come in handy for a lot of other developers.

If Roblox is able to address this issue, it would improve my development experience because this can open up so many pathways for developing with images.

30 Likes

I’d really love something like this. IMO roblox lacks tools for working with decals or any image types for that matter, so this would be a great step in the right direction

3 Likes

This feature would open so many doors. I’d also like to add to the feature request, a method to get the size of the image aswell.

7 Likes

I support this idea, but I’m going to play devil’s advocate here.

Every image uploaded to Roblox has to be approved by human eyes.
If people started using images to store other things, such as height maps, the approval team might have a hard time knowing what they’re looking at.

If this is just for a Studio plugin, you can already achieve this through the use of StudioService’s PromptImportFile and a png decompiler written in lua. Try it out yourself:

print(game:GetService("StudioService"):PromptImportFile({"png"}):GetBinaryContents())

Still, it’d be cool if we had this.
It’d also be cool if we had nearest neighbors image interpolation.

4 Likes

That would be nice if roblox had a documentation for the functions of file.

Because when i run that code it returns this:

4 Likes