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.

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.

64 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

8 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.

9 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.

9 Likes

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

Because when i run that code it returns this:

5 Likes

It’s been a year and we are still stranded with no library or methods to get image data. We already have stuff like the recently added height-map importers for terrain building, but we still have no way to do this on our own in normal scripts!

Having a way to overall read pixel data from images will really help with many projects and plugins!

16 Likes