Skip to main content
Participating Frequently
November 17, 2018
Pregunta

Assign sRGB profile to JPGs that have already been downsampled without changing image quality or size?

  • November 17, 2018
  • 2 respuestas
  • 3036 visualizaciones

I have a batch of JPGs without an embedded RGB profile that I need to change to sRGB. The images have been extracted from a very large and complex PSD file that the web designer provided, and then "Exported as JPG" to appropriate file size and quality for quick loading of the web pages that are being built. Unfortunately I did not notice until too late that the "Embed Color Profile" check box was unchecked. I know I can just open the JPGs and Convert to Profile > sRGB, but then I have to save the JPG again, which results in a further loss of image quality and/or a change of the file size. I don't want to change the image in anyway except to embed the sRGB profile. I can't figure out any way to achieve this, and I don't think it's possible, but I thought I'd put it out there to see if anyone else has a better solution than diving back into the complex original PSD file and extracting the images again, this time with the "Embed Color Profile" check box checked. Thanks!

Este tema ha sido cerrado para respuestas.

2 respuestas

Stephen Marsh
Community Expert
Community Expert
November 18, 2018

Another option is ExifTool...

Mac OS Terminal.app command line code to recursively embedd an sRGB ICC profile in all JPG files under a top level directory, overwriting original files without creating backups:

exiftool -overwrite_original -ext jpg '-ICC_Profile<=/Library/Application Support/Adobe/Color/Profiles/Recommended/sRGB Color Space Profile.icm' -r '/Users/username/Desktop/input file or folder'

There should only an approx. 3-5kb file size change in the before/after image for a matrix based sRGB profile (ExifTool does not change the binary image data, only metadata).

Prepression: Automator – DIY ExifTool GUI Services

__________________

MS Windows OS command line code to recursively embedd an sRGB ICC profile in all JPG files under a top level directory, overwriting original files without creating backups:

exiftool -overwrite_original -ext jpg "-ICC_Profile<=C:\Windows\System32\spool\drivers\color\sRGB Color Space Profile.icm" -r "C:\Users\username\Desktop\input file or folder"

dcaplanAutor
Participating Frequently
November 18, 2018

Stephen, any chance you would be willing to write up step by step instructions for using exiftool to accomplish this sRGB embed (Mac OS 10.12.6) without changing the image quality and only adding 3KB to the file size? I'm not a programmer, so the instructions would need to be understandable by a graphic artist. Thanks.

Stephen Marsh
Community Expert
Community Expert
November 18, 2018
Stephen, any chance you would be willing to write up step by step instructions for using exiftool to accomplish this sRGB embed (Mac OS 10.12.6) without changing the image quality and only adding 3KB to the file size? I'm not a programmer, so the instructions would need to be understandable by a graphic artist. Thanks.

You should give yourself more credit... However I do understand, many GUI users are reluctant or avoid using a CLI when they should not be. I was the same once myself, however I was missing out as I wanted to do things that only CLI tools or scripting would allow and CLI is much easier than JavaScript for a non-coder to learn.

P.S. There are ways to run CLI without needing to enter the code more than once and there are also some GUI front ends for CLI tools, however they are often a crutch and only offer simple edits, then you still need to enter CLI code for other uses.

My post #6 did cover the exact command required (however it does presume some knowledge)*:

Re: Assign sRGB profile to JPGs that have already been downsampled without changing image quality or size?

You need to know/find the exact file path and spelling to various files and folders. You can usually get info/properties and copy the path or drag the file or sometimes folder into a text editor to capture the path or drag the file or folder into a command line tool to capture the path.

*Until I can write a blogpost covering ExifTool for new users/GUI users, please start with these links:

Installation

Running

First use

Dummies

Getting started with the CLI

Some visual and or animated examples that I have created in either the Bridge or Photoshop forums and their scripting sub-forums may also help:

Re: Bridge not showing time created, only date

Re: changing UPPER to lowercase keywords in Bridge or Lightroom

Re: Script or Action to Batch Determine Transparency?

Re: Action that can read and put metadata from CSV file?

Searching either the Bridge or Photoshop forums or their scripting sub-forums for the keyword “Exiftool” will bring up many hits with various examples.

I also have some posts on ExifTool here that may help with some examples:

Prepression: ExifTool

rob day
Community Expert
Community Expert
November 17, 2018

What OS are you using? OSX comes with an AppleScript droplet that uses a shell script to embed a chosen profile into the files dragged on to the droplet. The script name is Embed.app.

dcaplanAutor
Participating Frequently
November 17, 2018

I am using OS 10.12.6. Where can I find "Embed.app"? A search on my computer and online has not come up with it. Sounds like it could be just what I need.

dcaplanAutor
Participating Frequently
November 17, 2018

I found the apple script at: Prepression: ColorSync AppleScript Archive

Embed

I copied it into a new Script Editor file and compiled it and saved it.  That allows me to run the script and embed the sRGB profile to one file at a time. I'm not sure how to create a droplet from this. But even so, just using the script will save me loads of time. Thank you.

Here is the script:

(*

Embed

©2009 Apple, Inc.

Use sips to embed a profile into an image.

*)

on run

display dialog "Embed a profile into an image."

set chosenFile to choose file with prompt "Choose an image " default location path to desktop folder

open chosenFile

end run

on open draggedItems

set embedProf to choose file with prompt "Choose profile to embed" default location POSIX file "/System/Library/ColorSync/Profiles"

repeat with thisFile in (draggedItems as list)

  try

   -- use 'sips --embedProfile' to embed the specified profile

   -- or use 'sips --embedProfileIfNone' to embed the specified profile only if the image doesn't have an embeded profile

   set profPath to quoted form of POSIX path of embedProf

   set filePath to quoted form of POSIX path of thisFile

   set cmdLine to ("sips --embedProfile " & profPath & " " & filePath) as string

   do shell script cmdLine

  end try

end repeat

end open