Ever been overwhelmed with a batch of images needing edits, but lacked the software or skills? Welcome to the world of Code Interpreter! Don’t be fooled by its name; it’s a powerhouse for image editing, using Python to seamlessly manipulate your visuals. But you don’t need to master Python.
Code Interpreter shines with its ability to handle batch operations, accommodating a myriad of images compressed into a zip file, up to a 512M limit. Its real charm, however, lies in its conversational approach to editing. Discuss your image needs as you would in a friendly chat, and watch them materialize effortlessly.
So, whether you’re an artist adding a special touch, a social media aficionado crafting captivating GIFs, or anyone seeking to enhance visuals, Code Interpreter is your innovative and engaging solution. Dive in, and spark your creativity!
Removing Excess Background
When displaying images on web pages or in presentations, it’s often necessary to remove the blank background surrounding the main subject. This helps maintain a unified style and improves the image’s loading speed.
To achieve this, you can compress the images you want to process into a file, upload it to Code Interpreter, and submit a simple prompt.
For example, I have three images that need background removal.
I will compress and upload them to Code Interpreter, and then instruct it with a prompt.
Please remove white space or extra space around the body of the image in the zip package. Finally, please provide a download link for the processed images.
Let’s see how Code Interpreter executes the process:
Once the process is complete, you can download the edited images by clicking the link provided by ChatGPT.
Here are the three images with the extra white background removed:
Converting Images to GIF Animations
GIFs are more visually engaging than static images and have the advantage of smaller file sizes compared to videos. They can effectively enhance social media engagement.
By using Code Interpreter, you can effortlessly transform images into GIFs.
Similar to the previous process, you need to compress the images you want to convert, upload it to Code Interpreter, and specify the task with a simple prompt.
Please convert the images in the zip package into a GIF. The images should be arranged in order by name. The resulting GIF should have a looping animation and a frame delay of 500 milliseconds between each frame.
Here are the three images I used to generate the GIF:
Let’s take a look at how ChatGPT handles the process:
Finally, here’s the resulting GIF.
You can also add additional effects like fade-in and fade-out to enhance the animation.
Watermarking is a common practice among photographers, artists, and content creators to assert ownership of their work and prevent unauthorized use. With Code Interpreter, adding a watermark is a breeze.
Here’s a simple prompt:
The zip package includes multiple images along with my logo. The filename of the logo is “logo”. I need assistance in adding the logo as a watermark to each image in the package. The watermark should be positioned 10 pixels from the bottom right corner of the image, with its original aspect ratio, a size of 5% relative to the image’s width or height, a transparency of 50%, and transparent background. Finally, please provide a download link for the processed image.
Let’s say I want to watermark the two images with my logo:
Let’s walk through the steps with ChatGPT:
The watermark was added to the bottom-right corner of each image. You can customize its size, position, and transparency by tweaking the prompt. Keep in mind that the maximum upload file size is 512M.
You can also batch add text or other images.
There are situations where we may need to pixelate or mosaic people’s faces to protect their privacy or identity. This too can be managed with a simple prompt in Code Interpreter.
Here are two portraits I will process:
By giving the prompt to Code Interpreter:
The zip package contains several images. Please identify the faces present in each image. Once the faces are identified, I need you to create mosaics to cover the faces in each image. Lastly, provide me with a download link for processed images.
We get these final images:
You can also blur, replace with other images, or even extract faces to separate images, not just mosaic them.
Reducing Image Noise
Photos taken in low light often have noise, like the small, irregular brown spots in the yellow area below. You can lessen this noise and improve the image quality through noise reduction.
After uploading the photo to Code Interpreter, you can use the following prompt:
Remove the noise from the image while preserving its textures and details. Once done, please share a download link for the processed image.
Check out ChatGPT’s result:
To remove noise from an image, we can use several methods. One of the most common methods is to use a denoising filter, such as the Non-Local Means Denoising algorithm. This algorithm works by comparing all pixels in the image instead of only those in a local neighborhood, so it can preserve details while removing noise.
Let’s proceed with this method and then you can check if the result is satisfactory. If not, we can try other methods.
The image has been processed and the noise has been reduced. You can download the denoised image from the following link:
Download denoised image
Please review the image and let me know if the noise reduction is satisfactory. If not, we can try different methods or adjust the parameters of the current method.
Here’s the final image processed by ChatGPT:
If you’re not happy with the result, ChatGPT Code Interpreter is flexible and open to modifications. To process multiple images simultaneously, just compress them, ensuring they don’t exceed the 512M limit.
Basic Image Operations
Code Interpreter can performs a variety of batch image operations, such as scaling, cropping, rotating, blurring, and sharpening.
Scaling adjusts the dimensions of an image, either by assigning new height and width or by setting a ratio. The process modifies pixel values to fit the new dimensions while preserving the visual content and aspect ratio.
- Scale this image to have a width of 800 pixels while maintaining its aspect ratio.
- Please scale the given image down by 50% of its original size.
- I want you to enlarge the image by a factor of 2.5.
- Can you resize this picture to a height of 600 pixels and preserve its original aspect ratio?
- I need this image to be scaled to a resolution of 1920×1080 pixels.
Cropping allows you to select and extract a specific region of interest (ROI) from an image, discarding the rest. The ROI can be defined by its upper-left and lower-right coordinates or by the width and height of its starting point. After cropping, only the pixels within the ROI are retained.
- Crop the image starting from the point (100,100) with a width of 500 pixels and a height of 300 pixels.
- Please extract the region of interest defined by the coordinates (300,200) to (800,600) from the image.
- Can you crop out a square of side 400 pixels from the center of the image?
- Crop this photo to focus on the area defined by the rectangle starting from the top left corner (0,0) to the bottom right corner (600,400).
- I want to isolate the subject in the middle, crop the image with a radius of 200 pixels around the center.
To rotate an image, pivot it around a specific point by a certain angle. This can be done either clockwise or counterclockwise. During rotation, pixel values are rearranged to match the new orientation, but the content remains unchanged.
- Rotate the image 90 degrees clockwise.
- Please rotate the given image 45 degrees counterclockwise.”
- Can you rotate the picture by 180 degrees around its center?
- Rotate this image around the point (300,300) by an angle of 30 degrees clockwise.
- I need this image to be rotated 180 degrees along the horizontal axis.
Blurring reduces noise and softens image details by manipulating the pixel values around each pixel. Techniques include Gaussian blurring, which applies a weighted average using a Gaussian distribution, and median blurring, which replaces each pixel with the median value of its neighborhood.
- Apply a Gaussian blur with a radius of 5 pixels to the image.
- Blur this image using a median filter with a 3×3 kernel.
- Can you apply a blurring effect to this image with a sigma of 2.0 using the Gaussian method?
- Please apply a motion blur to the image in the horizontal direction with a kernel size of 20.
- I’d like to soften the details in this photo, could you apply a blur filter to it?
My Final Take On
Code Interpreter’s image processing features are already pretty darn cool, but guess what? They’re just getting started! Right now, the tool only supports a slice of Python’s image-processing libraries, which puts a bit of a cap on what you can do. But don’t fret! If you’re itching to push the boundaries, there’s a nifty open-source alternative called Open Interpreter. This gem lets you download Python libraries straight to your computer, giving you the freedom to batch-process images without the hassle of uploads.
If this piques your interest, I’ve got another article lined up that’s just waiting to be devoured: