Created
October 19, 2017 16:26
-
-
Save wesen/ce067c8c3820db25e95b3f2c11b65754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear[nestPimp2]; | |
Options[nestPimp2] = Join[ | |
{ | |
PimpFunction -> Identity, | |
PostPimpFunction -> Identity, | |
PrePimpFunction -> Identity, | |
InnerPimpFunction -> Identity | |
}, | |
Options[ImageRestyle] | |
]; | |
nestPimp2[startImg_, restyleImgs_, level_, opts : OptionsPattern[]] := | |
Module[{res}, | |
res = Nest[ | |
OptionValue[PimpFunction]@ | |
ImageRestyle[OptionValue[InnerPimpFunction]@#, restyleImgs, | |
Evaluate[FilterRules[{opts}, Options[ImageRestyle]]]] &, | |
OptionValue[PrePimpFunction]@startImg, level]; | |
OptionValue[PostPimpFunction]@res | |
]; | |
Module[{ | |
large = Import["http://bl0rg.net/~manuel/wolfram-imgs/large.png"], | |
fire = Import["http://bl0rg.net/~manuel/wolfram-imgs/fire.png"], | |
schiele = Import["http://bl0rg.net/~manuel/wolfram-imgs/schiele.png"], | |
}, | |
{nestPimp2[small, {.3 -> fire, .3 -> schiele}, 5, | |
PostPimpFunction -> (ColorConvert[#, "Grayscale"] &), | |
PimpFunction -> (ImageAdjust[ | |
Colorize[#, ColorFunction -> "GrayYellowTones"], 1] &) | |
], | |
nestPimp2[small, {.1 -> fire, .3 -> schiele}, 3, | |
PerformanceGoal -> "Speed", | |
PimpFunction -> (Sharpen[#, 5] &), | |
InnerPimpFunction -> | |
Function[x, | |
ImageAdjust[Colorize[x, ColorFunction -> "CherryTones"], .5]]] | |
}] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment