Should I compress images in java backend before sending to frontend?

40 Views Asked by At

I am developing a project where we have a Java Spring backend server connecting with a front-end page through endpoints.

At the moment in one of our endpoints we are sending an image url to be represented in the frontend. Currently we can see some performance issues on the frontend when loading the images as the sizes vary quite a lot and some are quite big. In order to try and solve this I am checking how to compress the image in the backend in order to be easier for the front end to represent them. However, during my investigation I also noticed that there are a lot of tools to compress images in the front end directly.

My question is: Should I compress them in the backend (will include downloading the image + compressing it into a new file + sending it to frontend + deleting the file) or should it be done by the frontend?

0

There are 0 best solutions below