We are facing the performance issue with high-resolution media images. Is there any option to compress the image size while uploading to Media folder in EPiServer out-of-box?
Its not out the box but you can get hold of the image when its uploaded and resize if required. The example I blogged about uses TinyPNG:
You can also use the image resizer plug in (also mentioned in the blog) to stop the large images being delivered to the front end.
Also to note if you are on the DXC and the performance issues are around mobile and download sizes it should be automatically compressing your images for you using the Cloudflare polish service. You might want to check your headers to make sure it's working https://world.episerver.com/blogs/scott-reed/dates/2018/5/dxc-automatic-image-optimization/