If it is for an xhdpi screen, then it must have a proper resolution of 320 dpi.
Then in your graphic editor, set the resolution to 240 dpi for hdpi and the image will be scaled down to 2/3 the original (40*40) - save it.
Then undo and set the resolution to 160 dpi, for mdpi screens, and the image will scale to 1/2 the original, so it will be 30*30 - save it.
Then undo and set the resolution to 120 dpi, for ldpi screens, so the image will be scaled to a value beteen 22*22 or 23*23 depending on your graphical editor's approximation (the exact value is 22.5*22.5, but pixels aren't divisible, so it must be an integer) -save it.
All these images go in a proper folder under res:
drawable-ldpi
drawable-mdpi
drawable-hdpi
drawable-xhdpi