title: Compressing base64 data uri images
body: <p><strong>Problem</strong></p>
  
  <p>I'm creating multiple charts that are then sent to the server to create a PDF. This data can get large.</p>
  
  <p><strong>Question</strong></p>
  
  <p>What is the best way to compress and send the image data to the server</p>
  
  <p><strong>Background</strong></p>
  
  <p>The charts I'm creating are fairly complex, to save myself the headache all of this is converted to a canvas where the base64 data uri is generated. Currently the data uri(s) are posted to the server to handle the processing. Posted info can get fairly large at around 400-600kb each for a small chart and 12mb for the largest chart.</p>
  
  <p>The charts are org charts that can be manipulated/reordered.</p>
  
  <p><em>Is there a better method of compressing these strings before sending it back up to the server?</em></p>
  
  <p><strong>Research</strong></p>
  
  <p>Some things I've check out:</p>
  
  <p><a href="https://github.com/brunobar79/J-I-C/blob/master/src/JIC.js" rel="noreferrer">https://github.com/brunobar79/J-I-C/blob/master/src/JIC.js</a> (does not look like an option just resizes)</p>
  
  <p><a href="http://pastebin.com/MhJZBsqW" rel="noreferrer">http://pastebin.com/MhJZBsqW</a> (looks interesting)</p>
  
  <p>But references external libraries that I cannot find: <code>C_H_Image</code> <code>Lib_MinifyJpeg</code></p>
  
  <p><a href="https://code.google.com/p/jslzjb/source/browse/trunk/Iuppiter.js?r=2" rel="noreferrer">https://code.google.com/p/jslzjb/source/browse/trunk/Iuppiter.js?r=2</a> (looks like this could work but relies on decompression on server side)</p>