A suggested improvement: because of Photoshop's inane scaling of a and b (0-127 or 0-128 depending on polarity), the target values given in the IT8 data have to be scaled by 1.27 or 1.28 to give the correct values in the patch. Is it possible to change the script so that it assumes 0-100 for all input values? A message would be needed in the window to clarify the situation.
I think the scaling is being handled properly. The chosen Lab numbers are the numbers you get when you check the result in the Photoshop Info Window (to the accuracy of the integer size).
Here's the source: LabWriter.fml (https://sites.google.com/site/cliffpicsmisc/home/plugins/labwriter16.fml?attredirects=0&d=1).
This is the relevant part:
if ( imageMode==Lab48Mode )
{
scaleLstar = 32768.0 / 100.0;
scaleabstar = 128.0;
}else
{
scaleLstar = 255.0 / 100.0;
scaleabstar = 1.0;
}
....
// the following section scales the output Lab values to match Photoshop's internal representation
L = L * scaleLstar; // expand L* range from 100 to 255 or 32768
aa = (aa + 128.0) * scaleabstar; // offset so that all a* and b* values are positive integers
bb = (bb + 128.0) * scaleabstar; // and scale a* and b* to fill the integer range
After this, the float values L, aa, and bb are rounded to integers and written to their respective channels.
Let me know if this is not correct. If you want, you can modify the source and run it in the Filtermeister plug-in environment (free download: http://www.filtermeister.com (http://www.filtermeister.com)).