Comment 1 for bug 547011

Revision history for this message
robinmills (robinmills) wrote :

Guys

I've had an off-line discussion with Antonio about this. He hasn't updated me to say how this worked out for him. However I think this is useful background into the possibility of providing an ICC profile action in Phatch. The littlecms library is built and included in the Mac bundle for the jpegtrans utility.

Hi Antonio

I've tried the Synaptic Package Manager on Unbuntu 9.10 and typed jpegicc into the QuickSearch field. It offered "liblcms-utils", so I selected that and it installed jpegicc (painless).

I found some profiles such as "Black & White.icc" on my Mac (in /Library/ColorSync/Profiles/) and used them on a photo:

jpegicc -o "Black & White.icc" R.jpg mono.jpg

The original 2mb file was untouched and I got a 800k file with a black and white (not gray scale). I tried some others (Gray Tone, Sepia Tone and Blue Tone) and all seemed to work fine. I was rather disappointed that jpegicc removed all exif data from the output jpgs - so I'm a little uncertain about exactly what's been done. Presumably, he processed the image and wrote a minimal jpg in the output. I noticed that mono.jpg was still in the RGB color space - so although he'd converted the pixels, I wasn't convinced that he had really changed the color space in the JPG itself. Anyway - for sure it processed the image.

If you want to run this in a loop over a directory of files, you can use bash or Perl or Python or anything you like really. For example, in bash something like:

#!/bin/bash
mkdir output
for file in `ls *.jpg`; do jpegicc -o "Gray Tone.icc" $file output/$file ; done

will probably win the day (provided you don't have spaces in the file names).

I hope that helps.

Robin
http://clanmills.com

518 /Library/ColorSync/Profiles $ ls -alt
total 968
drwxrwxr-x 3 root admin 102 Jan 1 13:52 Displays
drwxrwxr-x 15 root admin 510 Dec 21 21:39 .
drwxrwxr-x 4 root admin 136 Dec 21 21:27 ..
-rw-r--r--@ 1 root admin 0 Sep 12 2009 Profiles
-rw-r--r--@ 1 root admin 0 Sep 12 2009 Recommended
-rw-rw-r-- 1 root admin 25624 Jul 29 2009 Black & White.icc <--- tried this one
-rw-rw-r-- 1 root admin 30420 Jul 29 2009 Blue Tone.icc <---- tried this one
-rw-rw-r-- 1 root admin 30420 Jul 29 2009 Gray Tone.icc <--- tried this one
-rw-rw-r-- 1 root admin 2736 Jul 29 2009 Lightness Decrease.icc
-rw-rw-r-- 1 root admin 2728 Jul 29 2009 Lightness Increase.icc
-rw-rw-r-- 1 root admin 30428 Jul 29 2009 Sepia Tone.icc <--- tried this one
-rw-rw-r-- 1 root admin 10780 Jul 29 2009 WebSafeColors.icc
-rwxrwxrwx@ 1 rmills staff 8708 Feb 2 2006 EW-sRGB
-rwxrwxrwx@ 1 rmills staff 200460 Jul 23 2004 EPSON Perfection4990 TPU
-rwxrwxrwx@ 1 rmills staff 200436 Jul 22 2004 EPSON Perfection4990
519 /Library/ColorSync/Profiles $

On Mar 31, 2010, at 2:12 AM, Antonio Roberts wrote:

Hi Robin,

Thanks very much for your suggestsions, I would be very greatful for a
walkthrough on how to get little cms to do this until Phatch has this
ability. I'm currently running Ubuntu 9.10 (though will be on 10.04
very soon)

Thanks again,

Antonio

On 25 March 2010 16:44, Robin Mills <email address hidden> wrote:
Hi Antonio

I will leave Stani (the Phatch team leader) to reply to your bug report. I have a feeling that this will be marked as "enhancement request" and one day it will receive attention. There is a 'Convert Mode' action - however I suspect you are looking for more than just colorspace change.

I'm working on Phatch and currently building libraries which we need for the 0.2.8 version which will have both a Mac and Windows installer. Yesterday I built the 'little cms' libraries which are used by dcraw (which is used to import raw camera images). http://www.littlecms.com/

I see that little cms has a utility jpegicc which I think does what you want (help screen below). You could run that from a script to 'run over' a directory of photos.

If Phatch can't help you at this time, I'd be happy to help you to get littlecms to do this for you. And that would be good preparation for adding an action to a future version of Phatch. I'm off on vacation on Saturday for a week, so I won't be able to do much until I return.

Thoughts? Which platform are you using? (Mac, Linux or Windows)

Robin
http://clanmills.com

----
530 /Users/rmills/Downloads/lcms-1.19.mac.bin/bin $ jpegicc
little cms ICC profile applier for JPEG - v2.1

usage: jpegicc [flags] input.jpg output.jpg

flags:

-v - Verbose
-i<profile> - Input profile (defaults to sRGB)
-o<profile> - Output profile (defaults to sRGB)
-t<0,1,2,3> - Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute)

-b - Black point compensation
-f<n> - Preserve black (CMYK only) 0=off, 1=black ink only, 2=full K plane
-n - Ignore embedded profile
-e - Embed destination profile
-s<new profile> - Save embedded profile as <new profile>

-c<0,1,2,3> - Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes) [defaults to 1]

-p<profile> - Soft proof profile
-m<0,1,2,3> - SoftProof intent
-g - Marks out-of-gamut colors on softproof

-q<0..100> - Output JPEG quality

-d<0..1> - Observer adaptation state (abs.col. only)

-h<0,1,2> - More help
531 /Users/rmills/Downloads/lcms-1.19.mac.bin/bin $
----

On Mar 25, 2010, at 9:03 AM, Antonio Roberts wrote:

Public bug reported:

I need to convert several images from one colour space to another. I
know that Phatch has support for several built-in colour spaces, but I'd
like to be able to select an icc profile file and then apply it to a
group of images

** Affects: phatch
   Importance: Undecided
       Status: New

--
Add icc profile to a batch of phots
https://bugs.launchpad.net/bugs/547011
You received this bug notification because you are a member of Phatch
Launchpad Team, which is subscribed to Phatch.

Status in Phatch = Photo & Batch!: New

Bug description:
I need to convert several images from one colour space to another. I know that Phatch has support for several built-in colour spaces, but I'd like to be able to select an icc profile file and then apply it to a group of images