How to get BinaryContents of a image?

I am trying to make a paint plugin. The user can select a image from the workspace and edit it in the plugin. I made this script but it did not do anything when i ran it:

local Image = game.workspace.ImageLabel.Image
local Binary = Image:GetBinaryContents()
print(Binary) 

Is this how you are suppose to do this?

GetBinaryContents is a function of Files which have to be imported manually by the user using PromptImportFile(s). Unfortunately, you can’t edit the binary contents, just view them.

2 Likes

I do not want to edit the contents, I just want to view the binary of the image.

Oh, I thought you wanted to edit it within the plugin. My bad. You’ll still have to ask the user to import an image using StudioService, though, I don’t think you can get binary contents from a Roblox asset id directly. Alternatively, you might be able to get the raw contents at https://www.roblox.com/asset?id=IMAGE_ID_HERE, but I don’t know if those are the binary contents and you’d have to proxy the request.

2 Likes

Later if i want to edit it i can make a copy of the binary and edit from that.

This was my post on that: How to Create a temporary id?

Can you create a temporary id and get the binary from that?

You need a File object to get a temporary id. If you have a File object, you can just use GetBinaryContents on it. If you just have the Image’s on-site id (rbxassetid://whatever) then you don’t actually have the File and can’t get its contents at all. If you want a File object, you have to use PromptImportFiles like I said earlier.

2 Likes