@SGaist Thanks for the response.
I just don't quite understand the following:
A: How this works with arbitrary style sheets(different amounts of values to be replaced)?
B: Can I only replace up to 100 unique sizes?
C: Where does the initial value for width come from(the one I will multiply with dpi_factor)?
Also would this method be more efficient performance wise?... I am running a lot of css through this function.