how to compress an image or picture into a specific width and heigth that i want???

input = any image file (gif,bmp,jpg)
Final outcome =*.jpg