Is it possible to get the color of a pixel on a gui?

  1. What do you want to achieve? I want to be able to get a color3 from a pixel on a screen gui

  2. What is the issue? how??

  3. What solutions have you tried so far? I cant find anything or how its possible

So lets say I have a ui on the screen, how would I get the color of a pixel of it?

I don’t think Roblox Studio has any built-in tools to assist you with that. Maybe this post can give you some clue on how you may want to do it.

1 Like

Sadly that post didn’t have any answers.

I’d say the answer is pixel data that you would import from an outside source, because after doing some research I came to the conclusion that pixels cannot be accessed by Roblox Studio tools.

You can get the pixel color of any image using this function.
local function GetPixel(Image, X, Y)
local X = math.clamp(math.floor(X), 1, Image.AbsoluteSize.X)
local Y = math.clamp(math.floor(Y), 1, Image.AbsoluteSize.Y)
local RawData = Image:GetImage()
return Color3.fromRGB(bit32.rshift([(Y - 1) * Image.AbsoluteSize.X + X], 0xFF000000), 24), bit32.rshift([(Y - 1) * Image.AbsoluteSize.X + X], 0x00FF0000), 16), bit32.rshift([(Y - 1) * Image.AbsoluteSize.X + X], 0x0000FF00), 8))

You can get the position of the mouse relative to the Image using this function.
local function GetMousePosition(Image)
local Camera = workspace.CurrentCamera
local CFrame = Camera.CFrame
local MouseHit = Camera:WorldToScreenPoint(Mouse.Hit.p)
local ImageHit = Camera:WorldToScreenPoint(CFrame:PointToWorldSpace(Image.AbsolutePosition + / 2, Image.AbsoluteSize.Y / 2, 0)))
local MousePosition = MouseHit - ImageHit
MousePosition =, MousePosition.Y)
MousePosition = (MousePosition / Image.AbsoluteSize) +, 0.5)
return MousePosition

You can use both of these functions together to get the pixel color of a specific point relative to the mouse.
Image = script.Parent.Image

local function OnMouseMove(Mouse)
local MousePosition = GetMousePosition(Image)
local PixelColor = GetPixel(Image, MousePosition.X, MousePosition.Y)



False! I have made it possible to grab image pixels without externals tool with my plugin and module.

This will also work in-game too!

Woah! this looks epic!

This text will be blurred

1 Like

Hey, so your plugin looks really cool, but do you know how I can render everything normally, but have like one or two blocks pixelated whenever I look at them?

Hey, I’m trying out your code, but I get this error.

Players.KUW_Alt1.PlayerGui.ScreenGui.ViewportFrame.LocalScript:18: invalid argument #2 (Vector2 expected, got Vector3)

This is the line of code.

local ImageHit = Camera:WorldToScreenPoint(CFrame:PointToWorldSpace(Image.AbsolutePosition + / 2, Image.AbsoluteSize.Y / 2, 0)))

Edit: I replaced it with,1,1) to experiment, but now I have this error.

GetImage is not a valid member of ViewportFrame "Players.KUW_Alt1.PlayerGui.ScreenGui.ViewportFrame"

Actually does Image:GetImage() even exist?

1 Like

I can’t find any documentation for :GetImage()

I don’t know what he’s talking about