Introduction
In the fast-paced world of social media, efficiency is key. Each week, I create and post original artwork to platforms like Pinterest and Instagram. This involves a multi-step process that includes generating artwork, upscaling images for high-quality prints, and preparing them with the necessary branding elements. While I have scripts to handle some of these tasks, I was curious to see if ChatGPT could help streamline and automate the entire workflow. This blog details my experience using ChatGPT Code writing to generate a script for resizing images, adding logos, and setting backgrounds, and compares it to my manual scripting methods.
Weekly Workflow
Each week, I undertake a series of tasks to prepare my artwork for social media:
- Create Artwork: Using a text-to-graphics AI system to generate original artwork.
- Upscale Artwork: Use Topaz Photo AI to upscale images for canvas prints.
- Prepare Templates: Load upscaled images into Affinity Photo 2 templates for Pinterest and Instagram. These templates include my website logo and a black background.
![A digitally animated, shaggy-haired, orange yak with large curved horns stands against a textured wall. Two small birds are seen flying in the background. A digitally animated, shaggy-haired, orange yak with large curved horns stands against a textured wall. Two small birds are seen flying in the background.](https://theartfulai.com/wp-content/uploads/elementor/thumbs/Cartoon-Cow-pin-qrcex0gqz24ammo824q15ma4ke83wnd4lxdsa8fw9y.png)
Automation with ChatGPT
I decided to automate the scaling and branding process using a script. Here’s my experience using ChatGPT for this task.
Initial Setup
To automate the process, I needed a script that could:
- Resize the images to the correct dimensions for Pinterest and Instagram.
- Add my website logo to each image.
- Apply a black background to each image.
The tools involved in this process were:
- ChatGPT: For generating the script.
- Paths to the Logo and Background: These paths are necessary to direct the script to the correct files.
- Required Image Dimensions: Specifying the exact dimensions for Pinterest and Instagram.
First Prompt Entered into ChatGPT
I started by crafting a detailed prompt for ChatGPT to ensure it fully understood the task. Here’s the initial prompt I used:
I have a macOS computer, I want to use a bash script that runs sips to convert a picture, make two copies of the picture and then scale each picture to a set size. Each picture will take the filename and append either -IG for Instagram or -pin for Pinterest. The Instagram picture will be scaled by the width 1080×1350, the Pinterest picture will be scaled to 1000×1500. Once scaled I would like to take a known picture, which is a logo which is a png and overlay the logo picture on both of the Pinterest and Instagram pictures. The logo will be scaled to 179×171.9 px and placed in the top right corner of each picture. Are you able to help me write a script to do this?
The final prompt which was used
I have a macOS computer and I want to use a bash script that utilises ‘sips’ and ‘ImageMagick’ to process an image for Instagram and Pinterest. The script should perform the following tasks:
Convert and Copy Image:
– Take an input image and make two copies.
– Append ‘-IG’ to the filename for the Instagram copy.
– Append ‘-pin’ to the filename for the Pinterest copy.
Scale Images:
– Scale the Instagram copy to a width of 1080 pixels while maintaining the aspect ratio.
– Place the scaled Instagram image onto a background image that is 1080×1350 pixels.
– Scale the Pinterest copy to a width of 1000 pixels while maintaining the aspect ratio.
Overlay Logo:
– Take a known PNG logo image, resize it to 179×172 pixels, and overlay it on the top left corner of both the Instagram and Pinterest images.
Final Outputs:
– Save the processed Instagram image with the logo as <original_filename>-IG.<extension>.
– Save the processed Pinterest image with the logo as <original_filename>-pin.<extension>.
Initial Script Generation
Using the prompt, I logged into ChatGPT using the desktop application to request the generation of the initial script. This script was intended to automate the entire workflow as described.
- First Script Output: The initial script generated by ChatGPT had several issues. The image sizes were incorrect, the logo was missing, and there were some logged errors in the output.
Iterative Process
The process of refining the script involved over 20 attempts and feedback loops over a period of 2.5 hours. Here’s a detailed breakdown of each step and the corresponding actions taken:
First Attempt
- Result: The generated script had incorrect image sizes and the logo was missing.
- Action: I copied the errors from the script’s output and pasted them back into the chat. I provided a detailed explanation of the problems to ChatGPT for further refinement.
Second Attempt
- Adjusted Script: ChatGPT provided a revised script based on the error feedback from the first attempt.
- Result: The image sizes were now correct, but the logo was still missing.
- Action: I reported the missing logo issue back to ChatGPT, detailing what had worked and what still needed fixing.
Repeated Steps
The process of refining the script required repeating the following steps multiple times until everything was working correctly:
- Running the Script: Each new version of the script was executed to check for errors and verify the output.
- Identifying Issues: I noted any issues such as incorrect image sizes, missing logos, or unexpected errors.
- Providing Feedback: Detailed feedback was given to ChatGPT, including the exact errors and observations from the script output.
- Requesting Revisions: I asked ChatGPT to adjust the script based on the identified issues and feedback.
![A grayscale illustration of a happy cartoon highland cow with large eyes and long, shaggy fur, standing against a textured background. A grayscale illustration of a happy cartoon highland cow with large eyes and long, shaggy fur, standing against a textured background.](https://theartfulai.com/wp-content/uploads/elementor/thumbs/Cartoon-Cow-IG-qrcex483qe9fx2irg6cjflbyxxpkrfs1yfzq7cabl2.png)
Iterative Improvements
This iterative process involved over 20 attempts, with each cycle focusing on resolving different problems one by one. Here are some examples:
Iteration 3:
- Result: The logo was partially embedded but not correctly positioned.
- Action: Provided feedback about the incorrect logo positioning and requested a fix.
Iteration 5:
- Result: The logo was correctly positioned, but one image was not scaled correctly.
- Action: Identified the scaling issue and informed ChatGPT, highlighting the discrepancy in the scaling function.
Iteration 10:
- Result: Correct scaling and logo embedding were achieved, but a new issue with image coloration emerged (one image was black and white).
- Action: Noted the coloration issue and communicated it to ChatGPT, pointing out the specific part of the script causing the problem.
Iteration 15:
- Result: Another issue with the logo placement occurred, with it being slightly off-center.
- Action: Adjusted the feedback to specify the exact coordinates and alignment needed for the logo.
Iteration 20:
- Result: Achieved the correct scaling, logo embedding, and background application, but there was a minor issue with the file naming convention.
- Action: Provided detailed feedback to ensure the naming convention was implemented correctly.
Final ChatGPT Prompt to Create the Script
After several iterations, I refined my prompt to provide even more detailed instructions. Here’s the final prompt I used:
Reflection
Time Spent
- Overall Duration: Approximately 2.5 hours were spent interacting with ChatGPT and refining the script to meet my needs. This included writing the initial prompt, testing the generated scripts, identifying issues, and providing feedback for corrections.
- Manual Method Comparison: In contrast, writing a similar script manually took less than an hour. The manual approach was more straightforward and less time-consuming.
Outcome
- Functional Script: The final script generated by ChatGPT successfully automated the workflow. It resized the images to the correct dimensions, added the logo, and applied the black background as specified.
- Intermediate Challenges: The process involved overcoming several issues such as incorrect image sizes, missing logos, and unexpected image coloration problems. Each issue required detailed feedback and multiple iterations to resolve.
Comparison with Manual Method
- Speed: The manual method was significantly faster, taking less than an hour compared to the 2.5 hours spent with ChatGPT.
- Reliability: The manual method was less prone to errors. Since I had direct control over the script, it was easier to anticipate and correct mistakes without the need for iterative feedback loops.
- Learning Curve: Writing the script manually required coding knowledge and experience, whereas using ChatGPT could be more accessible to those with less programming background, albeit more time-consuming.
Learning Experience
- Understanding ChatGPT Capabilities: Using ChatGPT provided valuable insights into its strengths and limitations in coding tasks. I learned how to effectively communicate requirements and debug errors through iterative feedback.
- Problem-Solving Skills: The process honed my problem-solving skills as I had to identify and articulate issues clearly to get accurate revisions from ChatGPT.
- AI Interaction: It was an interesting experiment in interacting with an AI model for practical coding solutions, showcasing the potential and current constraints