Merging Decals in a script

This might be a giant stretch, but is it possible to combine two decals into one image? For example. if I have one image having the letter “a” and the other image is a background. Would it be possible to combine those two decals so I can send it as one in a webhook?

I’m thinking some image software has an api that would allow me to do this, but not 100% sure.

Edit: Found this api but not idea how to use it: http://image-merger.herokuapp.com/

2 Likes

For what I know roblox is not an image software so I don’t think it have those advance things

2 Likes

Do you know if there’s an api that would allow me to merge images? (Not talking about Roblox Apis)


Api Url: http://image-merger.herokuapp.com/api/v1.0/

" Method Supported : POST"
" 1. Request must be JSON type i.e Content-Type : application/json
2. Images should be of same sizes and of PNG format."

{
   "foreground_url" : "https://www.roblox.com/avatar-thumbnail/image?userId=430874503&width=150&height=150&format=png",
   "background_url" : "https://www.roblox.com/avatar-thumbnail/image?userId=458587978&width=150&height=150&format=png"
}
2 Likes

When i use the api, where would I put the id? I see the api url but no place to send the image link anywhere.

you should add some error handling but here is a script example

local HS = game:GetService("HttpService")
local Api_Url = "http://image-merger.herokuapp.com/api/v1.0/"
local Data = {
	["foreground_url"] = "https://www.roblox.com/avatar-thumbnail/image?userId=430874503&width=150&height=150&format=png",
	["background_url"] = "https://www.roblox.com/avatar-thumbnail/image?userId=458587978&width=150&height=150&format=png"
}
Data = HS:JSONEncode(Data)
local ReturnData = HS:PostAsync(Api_Url, Data)
if ReturnData ~= nil then
	ReturnData = HS:JSONDecode(ReturnData)
	print(ReturnData["output_image"]["url"])
end

image

1 Like

I get the error, “Images were not found” everytime I run the script. Here’s what I added:

function GetImageUrl(player)
	local Layout = player.PlayerGui.CustomBadges.Begin.Type.Value
	local Image = player.PlayerGui.CustomBadges.Middle.Type.Value
	local HS = game:GetService("HttpService")
	local Api_Url = "http://image-merger.herokuapp.com/api/v1.0/"
	local Data = {}
	
	if Layout == 1 then
		
		Data = {
			["foreground_url"] = game:GetService("Players"):GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420),
			["background_url"] = "https://www.roblox.com/asset-thumbnail/image?assetId="..Image.."&22&width=420&height=420&format=png"
		}
	elseif Layout == 2 then
	Data = {
			["foreground_url"] = game:GetService("Players"):GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420),
			["background_url"] = "https://www.roblox.com/asset-thumbnail/image?assetId="..Image.."&22&width=420&height=420&format=png"
		}
	end
	pcall(function()
		Data = HS:JSONEncode(Data)
	end)
	local ReturnData
	pcall(function()
		ReturnData = HS:PostAsync(Api_Url, Data)
	end)
	if ReturnData ~= nil then
		ReturnData = HS:JSONDecode(ReturnData)
		return ReturnData["output_image"]["url"]
	else
		warn("No images were found.")
	end
end

Using pcalls got me this:
Screen Shot 2021-04-01 at 10.35.46 AM

It is throwing an error because the function you put into the foreground_url spot does not return an external url, it only works within roblox

see this: :GetUserThumbnailAsync() Not working for Roblox to Discord API - Help and Feedback / Scripting Support - DevForum | Roblox

and this: Just started getting a HTTP 400 bad request error - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like