As currently get image data from texture is limited to v 4.0 I made a rudimentary version which uses v 3. It’s quite laggy and you need the actual url of the image not the assetid.
Proxy Code: Glitch :・゚✧
(do not use this proxy in the example I will be password protecting at some point)
Example code for getting all of a users friends
local HttpService = game:GetService('HttpService')
local RunService = game:GetService('RunService')
local CanvasDraw = require(game.ReplicatedStorage.Modules.CanvasDraw)
local EndPoint = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds={userId}&size=180x180&format=Png&isCircular=false"
local function GetAllFriendHeadshots(id)
local success, AllFriends = pcall(function() return game.Players:GetFriendsAsync(id) end)
if not success then
warn(AllFriends)
return nil
end
local Ids = ""
repeat
for i,v in pairs(AllFriends:GetCurrentPage()) do
Ids = Ids..v.Id..","
end
if not AllFriends.IsFinished then
AllFriends:AdvanceToNextPageAsync()
end
until AllFriends.IsFinished == true
local Url = EndPoint:gsub("{userId}",Ids)
local success,res = pcall(function()
return HttpService:JSONDecode(HttpService:GetAsync(Url))
end)
if not success then
warn(res)
return nil
else
local Stuff = {}
for i,v in pairs(res.data) do
table.insert(Stuff,v.imageUrl)
end
return Stuff
end
end
local function FastWait(Count) -- Avoid lag spikes
local FastWaitCount = 0
if FastWaitCount >= Count then
FastWaitCount = 0
RunService.Heartbeat:Wait()
else
FastWaitCount += 1
end
end
local function Simplify(data)
local Newpixels = {}
local NewAlphas = {}
for i,v in pairs(data.colours) do
pcall(function()
--print(Color3.fromRGB(table.unpack(v)))
table.insert(Newpixels,Color3.fromRGB(table.unpack(v)))
end)
FastWait(4000)
end
for i,v in pairs(data.alphas) do
pcall(function()
--print(v / 255)
table.insert(NewAlphas,v)
end)
FastWait(4000)
end
return Newpixels,NewAlphas
end
local function GetImageData(link)
local url = "https://image-to-pixels-proxy.glitch.me/image-to-pixel?url="..link
local success,res = pcall(function()
return HttpService:JSONDecode(HttpService:GetAsync(url))
end)
if not success then
warn(res)
return nil
else
local Pixels,Alphas = Simplify(res)
local CanvasData = {
ImageColours = Pixels,
ImageAlphas = Alphas,
ImageResolution = Vector2.one * 180
}
local obj = CanvasDraw.CreateSaveObject(CanvasData,true)
obj.Parent = game.Workspace.Saves
obj.Name = link
return res
end
end
local Main = {}
function Main.CreateSaveOfFriends(userId)
local SaveObject = {}
local AllFriends = GetAllFriendHeadshots(userId)
for i,v in pairs(AllFriends) do
if not v then continue end
coroutine.wrap(GetImageData)(v)
FastWait(500)
end
end
return Main