#@gmic # # File : gmic_def.gmic # ( G'MIC default custom commands ) # # Description : Define recognized commands for the G'MIC interpreter # and available filters for GIMP plug-in. # ( http://gmic.sourceforge.net ) # # This file is also a part of the CImg Library project. # ( http://cimg.sourceforge.net ) # # Location : If you are using the G'MIC plug-in for GIMP, and made # a filter refresh via Internet, then a copy of this file # should be found in the folder : # # $HOME/.gmic_def.xxxx (on Unix-based OS). # %APPDATA/.gmic_def.xxxx (on Windows-based OS). # # Usage : gmic [-m gmic_def.gmic] (...) # # Copyright : David Tschumperle # ( http://www.greyc.ensicaen.fr/~dtschump/ ) # # License : CeCILL v2.0 # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html ) # # This software is governed by the CeCILL license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL # license as circulated by CEA, CNRS and INRIA at the following URL # "http://www.cecill.info". # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # In this respect, the user's attention is drawn to the risks associated # with loading, using, modifying and/or developing or reproducing the # software by the user in light of its specific status of free software, # that may mean that it is complicated to manipulate, and that also # therefore means that it is reserved for developers and experienced # professionals having in-depth computer knowledge. Users are therefore # encouraged to load and test the software's suitability as regards their # requirements in conditions enabling the security of their systems and/or # data to be ensured and, more generally, to use and operate it in the # same conditions as regards security. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. # #@gmic transfer_colors : _transfer_brightness={ 0 | 1 } #@gmic : Transfer colors of the first selected image to the other ones. transfer_colors : -skip ${1=0} -e[^-1] "Transfer colors of image [0] to image$?." -if {@#<2} -return -endif -v - -to_rgb[0] -to_colormode[1--1] {max(3,@{"-max_s"})} -c 0,255 # Convert all images to RGB[A] -repeat @# --sh[~>] 0,2 -rgb2ycbcr[-1] -rm[-1] -done # Perform RGB[A] to YCbCr[A] conversion. -l[0] -s c -histogram_cumul 256,1,0,255 -a c -* 255 -endl # Compute channel-by-channel cumulative histogram of target image. -repeat {@#-1} -l[0,-1] -if $1 -repeat 3 --sh[0,1] ~>,~> -equalize[-1] 256,0,255 -index[-1] [-2],0,0 -rm[-2,-1] -done # Transfer brightness + colors. -else -repeat 2 --sh[0,1] {~>+1},{~>+1} -equalize[-1] 256,0,255 -index[-1] [-2],0,0 -rm[-2,-1] -done # Transfer colors only. -endif -endl -mv[-1] 1 -done -rm[0] -repeat @# --sh[~>] 0,2 -ycbcr2rgb[-1] -rm[-1] -done # Perform YCbCr[A] to RGB[A] conversion. -v + _transfer_colors : # Check transfer_colors performance. -repeat @# -l[~>] -rgb2ycbcr -s c -histogram 256,0,255 -a c -dg 300,200 -endl -done