Skip to content

Instantly share code, notes, and snippets.

@oscardelama
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscardelama/9f1a52e7017666011be6 to your computer and use it in GitHub Desktop.
Save oscardelama/9f1a52e7017666011be6 to your computer and use it in GitHub Desktop.
rgb-noise: Scale function from linear sRGB to Lightroom sRGB
# Get the LR tifs var data
tif.var.zero <- vvm.tif$var.df
# Rename 'mean' and 'var' columns to avoid later name colision in merging
names(tif.var.zero)[3:4] <- paste0('tif.', names(tif.var.zero)[3:4])
# Remove sample file name extension to make possible the merge by picture file name
tif.var.zero$pict <- substr(tif.var.zero$pict, 1, 8)
# Compute the linear sRGB values
vvm.rgb.lin <- convert.to.rgb(target.space = 'sRGB', use.camera.tc = FALSE, target.tc = 'linear')
# Get the sRGB linear wide var data
lin.rgb.var <- vvm.rgb.lin$var.df
# Remove sample file name extension to make possible the merge by picture file name
lin.rgb.var$pict <- substr(lin.rgb.var$pict, 1, 8)
# Merge linear sRGB and LR tiff var data for each sample
lin.rgb.and.tif <- merge(lin.rgb.var, tif.var.zero, c('pict', 'channel'))
# Plot LR values as function of our sRGB linear values
ggplot(lin.rgb.and.tif, aes(x = mean/255, y = tif.mean/255,
group = channel, colour = channel)) +
ggtitle('Scale Applied to Linear sRGB\nBy Lightroom') +
xlab('Linear sRGB') + ylab('Lightroom sRGB') +
scale_x_continuous(breaks = seq(0, 1, 0.25),
labels=c('0%', '25%', '50%', '75%', '100%')) +
scale_y_continuous(breaks = seq(0, 1, 0.25),
labels=c('0%', '25%', '50%', '75%', '100%')) +
geom_point(size = 1.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment