Sign in to follow this  
Followers 0
adamchapman

Converting & Saving Google chatrs to png images

5 posts in this topic

I'm trying to automate a process to save my Google charts (built with the goggle charts API in html code) as png images.

As described at (https://developers.google.com/chart/interactive/docs/printing), you can get an encoded png as a string through the google API, although I guess when accessed through the browser address bar it is the browser that decodes the string and displays an image.

I've tried encoding the chart and saving it with Inetget, although the code below returns an "unterminated string" error on the line the string is defined on, before reaching the inetget call.
 

#include<Inet.au3>

$imageUri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7AAAADICAYAAADRJA3zAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABfGSURBVHhe7d1NjB1XgS/w8pMm8zTECfNiWyQgyGBbiuNhg8OHkLGfkExYwALhRTAb2NikJSQvUFhgK0Q2CyIWlpAc2RvYYLJozAIWBEvo2ViIjxgpYiBItnlBCjHyxwyJw+hNZuHX/3KddnVxu93dt9vp0/n9pKN7z626de+te251/eucql5zY0oDAAAAK9z/6G4BAABgRRNgAQAAqIIACwAAQBUEWAAAAKogwAIAAFAFARYAAIAqCLAAAABUQYAFAACgCgIsAAAAVRBgAQAAqIIACwAAQBUEWAAAAKogwK5ga9as+buyadOmburyOnv2bPt6ExMT3SPL6xOf+MT0Z/zjH//YPXrT008/PT2tX/L4cnj22WeXdfmzKes8JeujL997mTZcP+Naqs+73OstnzvLz3q6k/pt8079/gAAGE2AXeE2btzY3LhxY7pcvHjxTduJTphdjvCQZT733HPNN77xjfYzvve97+2mzPS9731vej08/vjjzVe+8pU2NK1GWR9Fglu+94VabWHrV7/6VXu7ffv29napjQqoCeP5Lkrby/cwPLgAAMCdI8BWJjvS2Yle7uCWkJAd9qNHj7b1hNdnnnmmvb/UXn755e7e/O3Zs6e9PXPmTHu7lB577LH2sz/xxBPdI3dWDlpE+Y5LcFuIhLE7bbnXW77rRx99tKstrdJrnN9W/yBNPks+Uz5b5Lu5cOFCex8AgDtPgK3MBz/4wfb2O9/5Tnsb/eGl/d6h/pDOMn3Yw1QeL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aUFAABgfHpgF2nYA1vOix32wA57aefr3Llz3T14a3jjjTfaAjW666672jKX+//hePPAXce7GtTllTf2Npf+e29XG+3uu9/WrJ0qUKPrr/+teX2qDG3btq27x0ohwC6SIcSwtAwhpmaGELPqGULMKmcIcT0MIV5C69evby5dutTVmubatWvNunXruhoAAADjEGCX0MMPP9ycOXOmqzXt1YofeuihrgYAAMA4BNgllH+fk9CaocQpGzZsaHbv3t1NBQAAYBzOgQVWBOfAUjPnwLLqOQeWVc45sPXQAwsAAEAV9MBW4t8vnmv+Y6pAjf5547bmf02VueiBpWZ6YFn19MCyyumBrYcAW4mLPzneXJgqUKNNH9/bbJwqcxFgqZkAy6onwLLKCbD1MIQYAACAKgiwAAAAVEGABQAAoAoCLAAAAFUQYAEAAKiCAAsAAEAVBFgAAACqIMACAABQBQEWAACAKgiwAAAAVEGABQAAoAoCLAAAAFUQYAEAAKiCAAsAAEAVBFgAAACqIMACAABQBQEWAACAKgiwS2hycrLZtWvXjHL+/PluKgAAAOMQYJfQtWvXmt27dzenTp2aLps3b+6mAgAAMA4BdglduXKlue+++7oaAAAAS0mAXUJXr15tNmzY0NUAAABYSgLsEvrd737XHDp0aPr812PHjnVTAAAAGNeaG1O6+4whF2uamJhoDh482OzYsaN9bP/+/c327dvb82IX6pFHHunu3fQvb2+a904VqNEf/9o0/3eqzGXjxo3Npk2buhrU5cKFC83Fixe72mjbtlyfKq93NajLuRfvnipru9po//qvW5v3ve99XQ3q8tvf/rb5t3/7XVe75fnnn+/usVIIsMvo8OHD7e2BAwfaWwAAABbPEGIAAACqIMAukTNnzrTnvfblok5lODEAAADjMYR4CU1OTs64cFP/fFgAAADGI8ACAABQBUOIAQAAqIIACwAAQBUEWAAAAKogwFK1J554otm4ceN0OXLkSDcFVqdnn312RpvfuXNnN+WmPJarol+4cKG9n1uo2bDNp8xXfguzze83wlLLPki/nZbS3zdJPe1yIeZqx/BWJMBSrey4//nPf24uXrw4Xb71rW8Jsaxa2Yn56le/2jz33HPTbf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w9R0MJmNkBz5H3Bx54oHt0ptkejwSBuZQjlNl5Gv6BGnV0FZZS/1ymvtu128gOVIJrnt8/rzDPLcPs+6XsXMGbJUMu5zM0crb2P9zWZ77ZDnzCnZZtcUJrRoKV7e58tuWAAEulytHM4QUHEl7LsOGcO5Ud9jKMLLep98+pyrkfRXqhylCa6O84Pfnkk9M7/R/4wAfaeYssN3+E5jt8BxYrFy5L2+u3tbS/DFkbnl81Stpw/iVJf96c83rw4MGudmunCt5s2Y6nzQ7bY9p8fxs83CZnNEJ6soYHFbN972/XXcWYN1MOpqS3trTT0m6LjEBYqHLg8fnnn29vsz3Xq8tqJMBSrfKvFbJzU0r/ggf5o1Au3JRp5YJO/Z2a/IHoP7c/zKfsOKVEWW7Or8q8ZVpZrh4rllvaXnr/+xdxSvubb49pzm+N/m8g7TohtiwvQSAX84CVIO0zbb60z9Lms80tfwOG2+SE1PwmhrJ9788312gcWG7l+hmlPUYCbblORw62py3nKsQLkd9LtuNZZpblOgasRmtuTOnuw1tKNu7DQFukZzdH9fMHBgAAWBn0wAIAAFAFARYAAIAqGEIMAABAFfTAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAKtA0/x9G19ZTQyImEwAAAABJRU5ErkJggg=="

$hDownload = InetGet($imageUri, 'chart_image.png')

Perhaps the encoded png string is just too long to handle.

If anybody can suggest a more elegant way to perform the task of invoking the javascript function that encodes the chart into a png, and then save that png to a local file I'd love to hear it.

In my limited experience I guess this all needs to be performed through a web browser, and using the IE or Inet  functions in autoit is the only way I can imagine.

 

 

Share this post


Link to post
Share on other sites



why not use a base64 function?

Share this post


Link to post
Share on other sites

Don't put a string so long in the IDE.

 

look:

Local $imageUri = 'iVBORw0KGgoAAAANSUhEUgAAA7AAAADICAYAAADRJA3zAAAAAXNSR0IArs4c6QAAAARnQU1BAACx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CLAAAABUQYAFAACgCgIsAAAAVRBgAQAAqIIACwAAQBUEWAAAAKogwAIAAFAFARYAAIAqCLAAAABUQYAFAACgCgIsAAAAVRBgAQAAqIIACwAAQBUEWAAAAKogw' & _
'AIAAFCFNTemdPcBAGBR/uu//l/zxhtvdDWoy1133dX84z/+z67GSibAAgAwtuvXX2uuv/ZqV4O6rL3n3mbt2nu6GiuZIcQAAABUQYAFAACgCoYQL9CxY8eaycnJrtY0Bw8ebHbs2NHVmmbXrl3dvabZunVrc+TIka4G' & _
'ALB6GUJMzQwhroce2AVIcD19+nRz6tSptiS8Hjp0qDl//nw7/fDhw83OnTunp1++fHlG2AUAAGDxBNgF2L17d3PixImu1rQ9r+vXr29eeOGFtv773/9+Rm9swuwf/vCHrgYAAMA4BNglsGHDhvb2ypUrzf3339/ej/' & _
'vuu6+5evVqVwMAAGAcAuwYzpw504bW9LqWYcRDGUYMAADA+FzEaQy5YFO5iFMC7MTERHP06NFm8+bN7fSc/3ry5MkZw47n69y5c909AICV7+6739asnSpQo+uv/615faoMbdu2rbvHSiHALtL+/fubLVu2NPv27ese' & _
'uRlohwH27NmzrkQMAKx6rkJMzVyFuB6GEC9CguowvEYu6HTp0qWu1jTXrl1r1q1b19UAAAAYhwC7ABkmnPCaqxEPw2s8/PDD7XmxRf7lzkMPPdTVAAAAGIchxAuQ//OaUDpUAm3Ca/4vbLF161bDhwG46T//z1T5+7' & _
'8hUIV/2jlV/ndXGc0QYmpmCHE9BFgAuBOuPjVVvtZVoDLrptruuie7ymgCLDUTYOthCDEAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRY' & _
'AAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQTYRTp//nyzZ8+ernZTHtu1a9eMMjk52U0FAABgHALsIiSoTkxMdLVbLl261GzdurU5derUdNm9e3c3FQAAgHEIsAt0+P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0MIV5C69evby5dutTVmubatWvNunXruhoAAADjEGCX0MMPP9ycOXOmqzXt1YofeuihrgYAAMA4BNgll' & _
'H+fk9CaocQpGzZsaHbv3t1NBQAAYBzOgQVWBOfAUjPnwLLqOQeWVc45sPXQAwsAAEAV9MBW4t8vnmv+Y6pAjf5547bmf02VueiBpWZ6YFn19MCyyumBrYcAW4mLPzneXJgqUKNNH9/bbJwqcxFgqZkAy6onwLLKCbD1MIQY' & _
'AACAKgiwAAAAVEGABQAAoAoCLAAAAFUQYAEAAKiCAAsAAEAVBFgAAACqIMACAABQBQEWAACAKgiwAAAAVEGABQAAoAoCLAAAAFUQYAEAAKiCAAsAAEAVBFgAAACqIMACAABQBQEWAACAKgiwS2hycrLZtWvXjHL+/PluKgAA' & _
'AOMQYJfQtWvXmt27dzenTp2aLps3b+6mAgAAMA4BdglduXKlue+++7oaAAAAS0mAXUJXr15tNmzY0NUAAABYSgLsEvrd737XHDp0aPr812PHjnVTAAAAGNeaG1O6+4whF2uamJhoDh482OzYsaN9bP/+/c327dvb82IX6pFH' & _
'Hunu3fQvb2+a904VqNEf/9o0/3eqzGXjxo3Npk2buhrU5cKFC83Fixe72mjbtlyfKq93NajLuRfvnipru9po//qvW5v3ve99XQ3q8tvf/rb5t3/7XVe75fnnn+/usVIIsMvo8OHD7e2BAwfaWwAAABbPEGIAAACqIMAukTNn' & _
'zrTnvfblok5lODEAAADjMYR4CU1OTs64cFP/fFgAAADGI8ACAABQBUOIAQAAqIIACwAAQBUEWAAAAKogwFK1J554otm4ceN0OXLkSDcFVqdnn312RpvfuXNnN+WmPJarol+4cKG9n1uo2bDNp8xXfguzze83wlLLPki/nZbS' & _
'3zdJPe1yIeZqx/BWJMBSrey4//nPf24uXrw4Xb71rW8Jsaxa2Yn56le/2jz33HPTbf5DH/rQjBCbx1z9nNUiBymfeeaZ6fae8vWvf73dmRc8WYk+/OEPz2ivKdk3yYGYhfjc5z43vT+TbXqWA9wkwFKl8ofgu9/9bntbfPvb3' & _
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t8/rzDPLcPs+6XsXMGbJUMu5zM0crb2P9zWZ77ZDnzCnZZtcUJrRoKV7e58tuWAAEulytHM4QUHEl7LsOGcO5Ud9jKMLLep98+pyrkfRXqhylCa6O84Pfnkk9M7/R/4wAfaeYssN3+E5jt8BxY' & _
'rFy5L2+u3tbS/DFkbnl81Stpw/iVJf96c83rw4MGudmunCt5s2Y6nzQ7bY9p8fxs83CZnNEJ6soYHFbN972/XXcWYN1MOpqS3trTT0m6LjEBYqHLg8fnnn29vsz3Xq8tqJMBSrfKvFbJzU0r/ggf5o1Au3JRp5YJO/Z2a/IHoP7' & _
'c/zKfsOKVEWW7Or8q8ZVpZrh4rllvaXnr/+xdxSvubb49pzm+N/m8g7TohtiwvQSAX84CVIO0zbb60z9Lms80tfwOG2+SE1PwmhrJ9788312gcWG7l+hmlPUYCbblORw62py3nKsQLkd9LtuNZZpblOgasRmtuTOnuw1tKNu7DQFu' & _
'kZzdH9fMHBgAAWBn0wAIAAFAFARYAAIAqGEIMAABAFfTAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYA' & _
'AAAKtA0/x9G19ZTQyImEwAAAABJRU5ErkJggg=='

FileWrite("test.png",_Base64Decode($imageUri))
ShellExecute("test.png")

Func _Base64Decode($Data);by Ward
    Local $Opcode = "0xC81000005356578365F800E8500000003EFFFFFF3F3435363738393A3B3C3DFFFFFF00FFFFFF000102030405060708090A0B0C0D0E0F10111213141516171819FFFFFFFFFFFF1A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132338F45F08B7D0C8B5D0831D2E9910000008365FC00837DFC047D548A034384C0750383EA033C3D75094A803B3D75014AB00084C0751A837DFC047D0D8B75FCC64435F400FF45FCEBED6A018F45F8EB1F3C2B72193C7A77150FB6F083EE2B0375F08A068B75FC884435F4FF45FCEBA68D75F4668B06C0E002C0EC0408E08807668B4601C0E004C0EC0208E08847018A4602C0E00624C00A46038847028D7F038D5203837DF8000F8465FFFFFF89D05F5E5BC9C21000"

    Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
    DllStructSetData($CodeBuffer, 1, $Opcode)

    Local $Ouput = DllStructCreate("byte[" & BinaryLen($Data) & "]")
    Local $Ret = DllCall("user32.dll", "int", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                                                    "str", $Data, _
                                                    "ptr", DllStructGetPtr($Ouput), _
                                                    "int", 0, _
                                                    "int", 0)

    Return BinaryMid(DllStructGetData($Ouput, 1), 1, $Ret[0])
EndFunc

Saludos

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Can you save that long string to disk? I can see that string in the java console but I don't know how to extract it using AutoIt.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks Universalist, I'd not seen that method before.

As impressive as that is, I have a problem getting that string from the html via Autoit. That encoded string is not in the original html that builds the chart - instead, the encoded png string is constructed by calling a Google-API function "getImageURI()" once the chart has been drawn in the browser.

I've tried opening the html of the chart page using _IELoadWait and then get the modified html with _IEDocReadHTML, but am having no luck. I expected the _IEDocReadHTML function would return a string containing the encoded png.

The html that constructs the chart is given below:

<html>
    <head>
    
      <script type="text/javascript" src="https://www.google.com/jsapi"></script>
      
      <script type="text/javascript">
        google.load("visualization", '1', {packages:['corechart']});
        google.setOnLoadCallback(drawChart);
        function drawChart() {

          var data = google.visualization.arrayToDataTable([
            ['Element', 'Density', { role: 'style' }],
            ['Copper', 8.94, '#b87333', ],
            ['Silver', 10.49, 'silver'],
            ['Gold', 19.30, 'gold'],
            ['Platinum', 21.45, 'color: #e5e4e2' ]
          ]);

          var options = {
            title: "Density of Precious Metals, in g/cm^3",
            bar: {groupWidth: '95%'},
            legend: 'none',
          };

          var chart_div = document.getElementById('chart_div');
          var chart = new google.visualization.ColumnChart(chart_div);

          // Wait for the chart to finish drawing before calling the getImageURI() method.
          google.visualization.events.addListener(chart, 'ready', function () {
            chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">';
            console.log(chart_div.innerHTML);
          });

          
          chart.draw(data, options);

      }
      </script> 
    </head>

    <body>
        <div id='chart_div'></div>
    </body>
</html>

_IEDocReadHTML simply returns "<html><head></head><body></body></html>".

I wonder if I could invoke the function which gets the encoded png as a string from autoit, and get the response back in the autoit environment rather than trying to read it from html?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0