Which is the better location to compress images ? In the browswer or on the server?
<p>I have a Django project and i allow users to upload images. I don't want to limit image upload size for users. But want to compress the image after they select and store them. I want to understand which is better:</p>

<ol>
<li>Compress using java-script on the browser.</li>
<li>Back end server using python libraries.</li>
</ol>

<p>Also it will be helpful if links can be provided to implement the better approach.</p>

<p>I would compress in nginx (or apache) since this is the right place to do it. no need for python libraries to do this</p>

<p>small example: </p>

<pre><code>gzip  on;
gzip_static on;
gzip_comp_level 9;
gzip_min_length 1400;
gzip_types  image/png image/gif image/jpeg
</code></pre>

<p>more on it --> <a href="https://www.nginx.com/resources/admin-guide/compression-and-decompression/" rel="nofollow">in the nginx docs</a></p>

javascript python html django image-compression