title: Why does resizing a JPEG image using PIL, increases file size?
body: <p>I have written a Python code which resizes an image into a max 1200 x 1200 frame, maintaining the aspect ratio. I am coming across this case where the input image(1080 x 1350) is 249.8KB whereas the output image(960 x 1200) is 317.2KB. This is happening in spite of <code>optimize = True</code> and maintaining the quality. My code is as below:</p>
  
  <pre><code>from PIL import Image
  from wand.image import Image as Wand
  
  MAX_RES = 1200
  photo = Image.open("input.jpg")
  breadth,height = photo.size
  qual = Wand(filename="input.jpg").compression_quality
  if(not((breadth &lt;= MAX_RES) and (height &lt;= MAX_RES))):
      resizeRatio = max (float(breadth)/MAX_RES, float(height)/MAX_RES)
      photo = photo.resize((int(breadth/resizeRatio),int(height/resizeRatio)))
      photo.save("output.jpg",optimization = True,quality=qual) 
  </code></pre>
  
  <p>Using <code>Image.ANTIALIAS</code> increases the size even more. </p>