
I tried using Claude Code to automatically set IPTC keywords for a large number of photos
This page has been translated by machine translation. View original
When it comes to Claude Code, it's often considered a tool valuable for app development, but because of the name including "Code," people tend to think it can only be used for coding. However, in reality, it's an excellent tool that can be utilized for a wide range of purposes, including novel writing and work automation.
This article introduces a method for automatically registering IPTC keywords to photos. I hope this will be helpful for those struggling with organizing large numbers of photos.
Current State of Photo Management
I currently manage my photos using software called Eagle. When I previously worked at a design company, I used Adobe Lightroom, but it felt somewhat overspecified for personal use, so I've now settled on Eagle.
Eagle has a convenient feature where if you enable automatically add IPTC keywords as tags when adding images in the settings, it will automatically read the IPTC keywords set in the image as tags when registering photos.

However, manually inputting IPTC keywords for a large number of photos is time-consuming. When dealing with hundreds or thousands of photos, it requires a considerable amount of work time.
What Are IPTC Keywords?
IPTC keywords are part of a standard image metadata format established by the IPTC (International Press Telecommunications Council). They are information that can be embedded directly into photo files and are used to record keywords or tags that represent the content of the image.
Similar to the Exif standard, but while Exif is mainly for camera manufacturers to record shooting conditions, IPTC was developed for news agencies and is used to organize vast numbers of photographs.
This standard is widely adopted in the field of photojournalism and is standardly supported by major photo management and editing software such as Adobe Lightroom and Photoshop.
By utilizing IPTC keywords, you can quickly search for specific content from a large number of photos. It also allows for systematic classification and organization by subject or location, and because the information is embedded in the file itself, the information is not lost when the file is moved.
Traditionally, manual keyword entry was necessary, but with the development of AI image recognition technology, this work can now be largely automated. This article introduces the results of attempting to automate IPTC keywords using Claude Code.
Manual IPTC Keyword Registration with ExifTool
First, let me introduce the basic method of manually registering IPTC keywords using ExifTool.
Installing ExifTool
ExifTool is a powerful command-line tool that can manipulate image metadata. It can be easily installed using Homebrew.
brew install exiftool
Basic Usage
For setting location information:
exiftool -GPSLatitude=35.7107818 -GPSLongitude=139.7953126 -GPSLatitudeRef=N -GPSLongitudeRef=E image.jpg
For changing the shooting date and time:
exiftool -DateTimeOriginal="2025:07:22 12:00:00" image.jpg
Setting Multiple IPTC Keywords
IPTC keywords can be set similarly. When setting multiple keywords, specifying -IPTC:Keywords multiple times will register each keyword individually.
exiftool -IPTC:Keywords="風景" -IPTC:Keywords+="山" -IPTC:Keywords+="自然" image.jpg
While it's possible to register tags manually using this method, it's not practical for a large number of photos.
Photo Analysis and Automatic Tag Generation with Claude Code
Now that we understand manual operations with ExifTool, let's tackle automation using Claude Code. After trial and error, the following workflow proved most effective.
Preparing the Directory Structure
First, create the following four folders in your working directory:
before: Store photos before processingprogressing: Temporarily store photos during processingafter: Store completed processed photosskipped: Store photos that couldn't be processed due to errors

Processing Rules for Claude Code (CLAUDE.md)
The following rules file defines the flow for safely processing images one by one and the criteria for setting IPTC tags. Particularly important points include:
- Staged file movement between the four directories
- Consistent tagging with English keywords
- Automatic skip function in case of errors
- Classification into five categories including people, animals, food, etc.
Since the detailed instruction document (CLAUDE.md) is lengthy, I've published it in the following Gist.
Processing Procedure
The processing with Claude Code follows these steps:
- Launch Claude Code in the working directory
- Load the CLAUDE.md file
- Instruct it to "process"
- Images in the
beforefolder are automatically processed one by one
During processing, files are automatically moved between directories, and if an error occurs, the relevant file is moved to the skipped folder.
Processing Results
Once processing is complete, tagged photos are saved in the after directory. Checking with ExifTool reveals results like the following:
% exiftool -IPTC:Category -IPTC:ObjectName -IPTC:Keywords -IPTC:Caption-Abstract image.jpeg
Category : ANI
Object Name : Dog in carrier
Keywords : dog, chihuahua, pet carrier, small dog, outdoor, street, travel, pet transport
Caption-Abstract : Small dog in pet carrier bag on street
When importing these processed photos into Eagle, IPTC keywords are automatically recognized as tags, making search and classification possible.

Strictly speaking, it's a Chiweenie (a mix of Chihuahua and Miniature Dachshund), but since only the head is visible, it's recognized as a chihuahua.
Summary
By utilizing Claude Code, I was able to significantly automate the photo tagging work that was traditionally done manually. This method makes it possible to efficiently add metadata to hundreds or thousands of photos.
Claude Code is not just a coding tool, but also a powerful agent for automating rule-based tasks. I feel it has the potential to be utilized in various business operations, not just photo management.
If you're struggling with organizing a large number of photos, please try this method. It should greatly improve your photo management efficiency.
Notes and Troubleshooting
API Usage Limitations
Image analysis with Claude Code seems to consume more API than coding work, reaching limits faster. For Pro plan users, as a guide, you may reach the limit after processing about 50 images. If processing large quantities, it might be better to split the task across multiple days.
Comparison with Other AI Tools
This article verified using Claude Code. Claude Code provides stable results in image analysis. Other AI tools were not included in this verification.
File Format Compatibility
Confirmed to work with JPEG image files. For PNG images, image analysis is possible, but there may be limitations in writing IPTC metadata with ExifTool afterward.
Customization Possibilities
The CLAUDE.md file can be customized according to your needs. By defining a keyword system specialized for specific industries or uses, more specialized tagging can likely be achieved.


