Posts

How to Compress Image With Custom Ratio Without The Support of Third Party Library ?

Image
  Create New Angular Project Let’s create a new angular project using the  Angular CLI tool  by executing the following CLI command ng new image-compression Would you like to add Angular routing? Yes Which stylesheet format would you like to use? CSS What’s Image Compression? Image Compression  is when we reduce the resolution of the actual image. Ex – suppose there is an image with a resolution of 1250 x 450 and for our logo we want the image to be compressed in 100 x 30 resolution then we have to reduce the height and width of the image with the required resolution (height and width) so that the UI won’t distort. What’s Different Here? In this blog we will not use any  third-party library , this will be pure code. In  third-party  libraries, the image is compressed in their own format we cannot set the required height or width of the image also most of these libraries return  base64  data and some APIs don’t accept  base64  so in this blog, we will set the required resolution (height