Getting image info & Web Scrapping

I have been trying to find a method to getting an image’s width, height, and all the individual pixel colors.

Firstly, I tried a Lua PNG library, however as you can guess, it only works for PNGs, and not even all PNGs work.

I then thought that the actual image url could correlate with the asset Id, however I have not found a connection between the two.

At this point I was getting desperate and realized I could try Web scrapping. However, I don’t know if it is appropriate and doesn’t go against ToS, because all I am doing is getting an Id, open the library page ("" + imageId), then get the image url from ("#AssetThumbnail .thumbnail-span img")[0].src, then sending this back to the Roblox experience.

ImageId (Lua server) -> ImageId (JS) -> "" + ImageId (php) -> getContext2d /*or a different method*/ (JS) -> json.stringify (JS) -> json decode (Lua server)

If this case of web scrapping is not allowed or there is an alternative, please let me know!

TL;DR: I need a method of getting image data (width, height, colors, etc.) from an imageId, the only method I could think of was Web Scrapping, is there another method, and is web scrapping against ToS?

Thanks in advance.

1 Like

I’m not 100% sure on this but I feel like Roblox won’t allow images not from the inventory/toolbox (uploaded to Roblox)

It is images exclusively on the roblox library, since I get the assetId, then in php I put it in the string

// php
$url = "" + assetId; 
// assetId is a parameter from a post request, it is checked to be a whole number integer on the server side (php)

This would be very easy to do with a regular url, but I am trying to use the assetId, which means I have to use web scrapping, to get the right img.src, which contains the url.

As mentioned above, using JS queryselector with “#AssetThumbnail .thumbnail-span img”, you can find the img tag I need, then we can easily get the src.

My question is, even though I am strictly looking at images roblox has moderated, and only extracting the image link from the site, am I breaking any ToS, or is there a better way on achieving this.