Color Profile across a segment, or, Color Transition moving along a line,
in your photo of stains or drops (with Excel)

history, inside the problem, the software, how to use, examples, donations
colorprof n.1colorprof n.2
Fig.1, on the left a stain, a splash on a surface; on the right a measure of the colours


  First, this is not a software for ICC profile for color management of your printer or monitor. The ICC Color Profiles describes the color attributed to a particular device or viewing requirement by defining a mapping between the device source or target color space. If you need to know more, see this pdf (244 KB).

  Having a stain, on a surface, we can digitalize and with a free software obtain a color profile across a line (someone call this Line Profile RGB Analysis). This is more important for Cultural Finds to monitoring the progress of degradation, or better to measure the cleaning.

  In Fig.1 it is shown the problem, on the left the stain and on the right the chart produced by one of the software cited below.

  1. thanks to San Diego State University; the better description of the problem Intensity Profile of Matlab with example's chart,
  2. also from San Diego State University; a very small Glossary on terms used,
  3. from M. Benallal, J. Meunier; a paper of 2003 on Real-time color segmentation of road signs (414 KB) describing exactly "the RGB profile of a line (identified with the white arrows) drawn across a STOP sign shows the 'nearly' primary nature of the sign color with the red component being much higher than the two other ones",
  4. from University of Chicago; a description of use of Plot-Profile command, in ImageJ, read the file Basic Intensity Quantification with ImageJ (560 KB),
  5. from Dresden School for Biomedicine; a long file on Basics of Quantitative Image Analysis (8.7 MB), this is what you really need to know about 'Image Processing' .... but never thought to ask,
  6. from a producer of good microscope; the description of the Digital Sight ACT-1 software. At the end of this page do see the description of Line Profile function,
  7. of course from Matlab/Octave; a good example of Pixel-value cross-sections along line segments,
  8. .
  9. the main web site of ImageJ software 1.xx, with documentation, help, plug-ins and binary downloads,
  10. only as a suggestion, another free software for image analysis, ICY: an open community platform for bioimage informatics,

  There are cited above routines for Matlab/Octave and for "R" devoted to solve this problem. But it is still difficult for my students to grasp all parameters used in those routines and often the subtended errors.

  Accounting all I said previously, I have selected one other time Excel to better calculate the profile, see the software section.


Inside the Problem

  In the Fig.2 you can see an ancient paper with foxing, on the left the paper as-is, on the middle the paper cleaned with the method B, and on the right the same paper is cleaned with method A.

stain-as-is  stain clean b  stain clean a
Fig.2, on the left the paper as is, on the middle the cleaning method B, on the right the cleaning method A

  In studies on Cultural Heritage it is necessary to measure more accurately the progress of degradation. On the other hand, the restoration (cleaning in our case) needs a more accurate measuring system which allows to not completely remove the degradation but only to stop its progress and permit a good readability at work.

  The idea is to use digitalisation of the surface and some free software to calculate the RGB profile along a line. The line was draw starting on a "clean" zone of the sample, passed through the mark and ending in the opposite "clean" zone.

  Strarting from a RGB digitalisation one of the problems is obtaining an accurate Black & White profile. This software solves, partially, with an external computation by a plugin and with an internal elaboration. Another problem is finding a "true white" point across the line to make the white balance, this is an operator's problem.

  We need, probably, the following:

  1. the photo: to digitalize the sample we must used a method more than reproducible. Probably a photo chamber is not sufficient, the illuminance, the position, the focal length, the exposition must be the same or the difference after and before cleaning can not be measured,
  2. a scanner: an idea is to use a top quality scanner (not in resolution but in color accuracy). The scanners have other problems as different light in different points of glass, a break-in problem after switch on. A solution is to cut a black mask to cover all the glass with a hole for the sample. The position of the hole must be evaluate for every scanner, and this check overcomes the break-in problem,
  3. the DPI: every scanner has a mechanical resolution and a more larger digital/interpolate resolution. Is better to use DPI value up to mechanical resolution. Probably is not necessary a high DPI, larger produce Moiré effect and noise to measure stains and mask. Every sample has a better DPI setting, please do few tests to select it,
  4. the line: the line used to produce the profile must be the same on the different photo of the sample. On the sample can be cut 2 holes with a needle, or with a drop of ink. Alternatively we can produce a graphic layer to be fused, transparent, over the photo; but produce a digitalization with scanner in the same position and same width/height after a week is difficult. A better way is finding 2 points, with a digital zoom, already present in the sample, 2 characters in the paper, a crack in the marble or a similar one
  5. almost 5: in this image analysis the reproducibility is essential. To check the researcher must do almost 5 digitalisations of the object (removing and remounting on the scanner!), and then, on the 5 photos draw the line and produce 5 RGB profile. So it is possible to evaluate the reproducibility of the measure chain,
  6. software version: only after a lot of work on point IV, as above, we can check if different versions of the software for image analysis or different plug-in produces the same values. Please check more the driver of the scanner. An idea is not change the versions through the measures project,
  7. no ICC profile: is better not to use, or disable, every color management profile for the scanner, for the monitor, for the printer. Sometime the ICC profile can be non linear and can change the gamut of the instrument.

The Software

  This free software was distributed under Creative Commons Public License, CCPL 3.0, see my Copyright web page. Please read accurately the Liability Waiver in red.

  There is only one version working on MS-Excel 2000, up to MS-Excel 2003, was tested on MS-Excel 2007 and 2010 version. Are available:


How To Use

  Dear students, this is not a course on Excel so you should already know how to use formulae and functions. I remember you to pass every lesson for Excel 2003 in this Course, and after that, pass all lessons of 2010 version (and do ALL projects).

  Very often the writer of the software is not the best writer of "instructions", he/she already knows how to use it! Nevertheless, I have made here a tentative to describe how proceed:

Fig.3, the screenshot with the 2 plugin windows, click here to zoom image


  As an example I have produced the file with photo of samples.

  A photo of marble Ravaccione is presented here, in the file, with the 2 profiles saved in .tsv format. This is the example already fitted in the main spreadsheet and it is shown in Fig.1 and Fig.3. (.tsv = tab separate values)

colorprof n.3
Fig.4, result chart produced by our software for the sample of Fig.1, with white balance

  In Fig.4 above the elaboration of the stain on Ravaccione's marble as described before and using our software. It was applied also the white balance looking for a pure white point across the line. The data elaboration of our software permites an easy comparison of the masks and/or better comparison between 2 different cleaning methods.

  In the file is presented the photos of Fig.2, as working example. It is a margin of a paper of XVII seculum, the file margin-1r.png is the stain as-is, the following show 2 cleaning methods. Also, in the file, there are the B&W profile and RGB profile already computed with the plugins. The '1r' is the original one, the '3r' photo is passed with cleaning method B, and after that, on the same sample passed a different cleaning method A obtaining the '2r' photo. You can use it to check the capability of this software to show the difference among the 3 surfaces. In the .zip file there are the 3 profiles solutions for margin-xx photo. Please find your better cleaning method.

  To sum up, there are present the photo of marble Calocara and one margin of an ancient paper dating 1808.


  If you know Excel you can expand or reduce the 320 rows, or the 500 rows, and probably can design a better solution.


Donations if you have a Bitcoin wallet

  If you have a nice fat wallet you can send a few cents to this code 1ETv1mJTZTB7EiXwZkucF2BTA512Rkaw6 maybe with a message (be careful to the transaction cost, send 0.1 and pay 0.01 is not a good idea).

1ETv1mJTZTB7EiXwZkucF2BTA512Rkaw6    <== my code , Thank you.

Donations if you have not a Bitcoin wallet

  If you like this work and measures you can make a small donation of Bitcoin. You do not need a wallet to make a donation, indeed even those who have Bitcoin wallet is better to pass for a web site that "gift" currency since this does not have a transaction cost.

  To make a donation you must use some of your web-time. Go to, enter my code 1ETv1mJTZTB7EiXwZkucF2BTA512Rkaw6 enter the Captcha code that you see, press "Claim Now" button. Wait 15 minutes on the publicity page, when the 15 minutes pass fill the new Captcha and press "Claim Now" again. To get some value are necessary 10 pages or more. Be careful, do not use roulette, dices, casino and other stealing web site.

1ETv1mJTZTB7EiXwZkucF2BTA512Rkaw6    <== my code , Thank you.

Universita' Degli Studi di Roma
La Sapienza
Dr. G. Visco
appointed professor for chemometrics & ....
Corso di Laurea in: Scienze Applicate ai Beni Culturali ed alla Diagnostica per la loro Conservazione

goto_back   help_page   page_copyright   author's page

Back Page   read help   C© Copyright   we did it