How to Remove Color Profile with ImageMagick Convert?
Removing embedded color profiles from your images is a quick way to reduce file sizes and strip unnecessary metadata before publishing them to the web. By utilizing the powerful open-source command-line tool ImageMagick, you can easily strip these profiles from single images or batch-process entire directories. This guide will walk you through the precise commands needed to clear color profiles safely while ensuring your images remain optimized and widely compatible across all digital platforms.
Understanding the Remove Profile Commands
ImageMagick provides a couple of distinct ways to handle profile
removal depending on how much metadata you want to get rid of. The
standard tool for this process in modern versions of ImageMagick is
magick, though the legacy convert command is
still widely supported and functionally identical for these
operations.
- The
-stripOption: This is the most efficient method if you want to remove all profiles, including ICC color profiles, EXIF data, orientation tags, and Photoshop thumbnails. - The
+profileOption: This is a more surgical approach. It allows you to target and remove specific profiles (like just the ICC profile) while preserving other valuable metadata.
Method 1: Stripping All Profiles (Recommended for Web)
If your goal is to minimize file size as much as possible for web performance, stripping all metadata and color profiles is the best route.
To strip everything from an image, use the following command structure:
convert input.jpg -strip output.jpgNote: If you are using ImageMagick v7 or newer, the modern syntax replaces
convertwithmagick:magick input.jpg -strip output.jpg
Method 2: Removing Only the Color Profile
If you need to keep your camera’s EXIF data (like exposure settings,
date taken, or GPS coordinates) but want to drop the heavy embedded ICC
color profile, you should use the +profile flag instead of
-strip.
To remove just the ICC profile, use this command:
convert input.jpg +profile "icc" output.jpgAlternatively, you can use a wildcard to strip all profiles while leaving other metadata intact:
convert input.jpg +profile "*" output.jpgBatch Processing Multiple Images
If you have an entire folder of images that need their color profiles removed, doing them one by one is inefficient. You can combine ImageMagick with a simple command-line loop to process them all at once.
On Linux and macOS (Bash):
for img in *.jpg; do
convert "$img" -strip "stripped_$img"
doneOn Windows (Command Prompt):
for %i in (*.jpg) do convert "%i" -strip "stripped_%i"A Crucial Warning on Color Distortion
Before you strip a color profile, it is important to know what kind of profile is embedded. Digital screens primarily use the standard sRGB color space.
- If the image is already sRGB: Removing the profile is perfectly safe. The image will look exactly the same but will have a smaller file size.
- If the image uses a wide gamut (like Adobe RGB or ProPhoto RGB): Stripping the profile without converting it first will cause the colors to look dull, washed out, or incorrect on standard web browsers.
To prevent color distortion on wide-gamut images, you should always convert the image to the sRGB color space before stripping the profile data:
convert input.jpg -colorspace sRGB -strip output.jpg