-1

Looking to automate the tedious clicking to change the backround of my PNG images from white to transparent.

The images reside in Google Drive, and as new images are submitted I have to make it transparent, each time, again. There's got to be a better way!

Lebulose
  • 13
  • 2
  • 1
    What is the manual process that you use? – Alan Wells Sep 23 '14 at 03:46
  • 1. Upload to [image editing site](http://www.online-image-editor.com/help/transparency), 2. select "replace selected color" 3. click on white background 4. Save to desktop. 5. upload new transparent image back to Google Drive. 6. Get rid of original .... etc etc etc task task etc.... – Lebulose Sep 23 '14 at 11:39

1 Answers1

0

I don't see any way to use that website with code. That website has what it calls an API, but it looks like it's nothing more than a link. You could use something like AutoIt, to reproduce the keystrokes that you manually do.

AutoIt website

If there was an online picture editor that had an API that would receive HTTP Requests, Apps Script can send and receive HTTP Requests.

Google Documentation urlFetch

But the online picture editor would also need to read your files from your Google Account.

HTML does have a canvas tag, that you can manipulate pictures with, but Apps Script currently doesn't work with the canvas HTML tag the last I knew.

You can access your Google Drive with Apps Script, and get files, but then you'd need to either send the file out somewhere, or process it yourself, just like that online picture editor does. If Caja would allow the HTML Canvas tag to work with HTML Service, there might be a way to automate what you want.

I created a way to re-size pictures with the Canvas tag, but it wouldn't work with Apps Script HTML Service.

Alan Wells
  • 30,746
  • 15
  • 104
  • 152