You need to write the code yourself. But we will help you if you list the code here and show us where you are stuck.
You need following knowledge/code:
- a HTML-page with an upload-button on it.
- a Java-Servlet which gets the uploaded data and saves it as image file.
This servlet detects the image format according to the MIME type and file extension. Then it creates an image-object of this format from the upload-data. Then it converts the various source formats (for example bmp, gif, tif, png) to a single destination format. A suitable image-conversion library should make this task easy. The best destination format is jpg, because it can be easily reduced further on and is small by itself. If the file size of the converted picture is still too big, then it can be reduced by either saving the picture with lower jpg-quality or, more effectively, by reducing the canvas size. (e.g. from 1000x1000 to 500x500) before saving.