python - Bulk download images from paths in .csv -> batch edit in GIMP -> upload -> gather links in .csv
Shopify's bulk product upload feature is reasonably easy to use, but uploading images is always a struggle and I'd like to automate the process as much as possible.
I get excel files from vendors with image links in them, I could copy the links directly into my shopify upload .csv, but then I get formatting issues on my site because the aspect ratios always vary. What I'd like to do is write a script that combines the following steps, or achieves the same goal by other means.
Download all the images from the links in the file from the vendor. This script seems like a start: https://gist.github.com/davidbauer/11055010 (https://gist.github.com/davidbauer/11055010)
Use the webfix1b.py plugin I'm already using to reformat all of the download images. https://bentrixtips.wordpress.com/2012/05/24/batch-process-images-with-gimp/ (https://bentrixtips.wordpress.com/2012/05/24/batch-process-images-with-gimp/)
Upload the newly re-formatted images to dropbox or google drive
Gather the share links (programmatically) for the newly uploaded files and compile them in a .csv
Match the new links with the original links (by file name), and replace them.
Does this seem achievable?
For 2) you don't need to use Gimp. There are libraries for this kind of simple image editing, such as the ImageMAgick toolbox (that has Python bindings)
3) and 4) are likely the same, when you upload a file you should get a link (didn't look too closely at the DropBox API though).
5) Dangerous, you could have several files with the same name.
Last, it may be more efficient to do the download/transform/upload/update CSV for each file in turn, because you can likely run several operations in parallel (and it also solves the problem in your step #5)
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.