"im" is often used as an abbreviation of "in dem" which is the direct translation of "in the/this" but it is also used as an abbreviation of "in einem" which directly translates to "in a" and somtimes "im" is just translated as "in"
Let's take "Der Saft ist im Glas" as an example.
If you are trying to say that it is in a specific glass that you could point to, you would use "in dem". If you are just talking about the general method of storing juice you would either use "im" or to be more precise "in einem". Using "in einem" tells you that it is in a glass but the actual glass isn't really specified or relevant right now.
"Der Saft ist in einem Glas" is basically the same as "Der Saft ist im Glas". But it is very different from "Der Saft ist in dem Glas" which is also basically the same as "Der Saft ist im Glas".
To translate these:
"Der Saft ist in einem Glas" => "The juice is in a glass"
"Der Saft ist in dem Glas" => "The juice is in the/this glass"
"Der Saft ist im Glas" => "The juice is in the/this glass" or "The juice is in a glass"
As a bonus:
"Das passiert im echten Leben" => "That's happening in real life"
Always fun to think about the weirdness of my mother tongue :)
Edit: These abbreviations are mostly used when the context already makes it clear which it is going to mean. Otherwise they are just confusing.