The error occurs because size is an array, not an object. To fix it, parse the JSON as JObject and access size as JArray:
Dim jsonObject As JObject = JObject.Parse(inJson)
Dim sizeArray As JArray = jsonObject("img")("size")
Dim width As Integer = sizeArray(0)
Dim height As Integer = sizeArray(1)
Avoid casting JArray to JObject.
If you found helpful, feel free to tick as a solution.
Happy Automation