Other way is to scale shadow image by sprite image. I made a quick code that should work.
It is based on Sprites width (Because shadow is 32x32 + adding height to calculation would over complicate things)
This simply draws shadow based on sprites width. If its bigger than the shadow width then the shadow gets resized to the size of Sprites width x Sprites width. This way quality loss will be minimal. Anyway here is the code: