Update
Here is a non-hackish way to reproduce the Heike's style of torn edges using ImageEffect
of version 10.2 with even higher irregularity (irregular steps):
i = ExampleData[{"TestImage", "Mandrill"}];
t = Module[{step = 10, if, n = 2 Total[ImageDimensions[i]], k = 0},
if = Interpolation[
Transpose[{Accumulate[Prepend[RandomInteger[{step, 2 step}, n], 0]],
RandomReal[1, n + 1]}], InterpolationOrder -> 1];
ImageEffect[i, {"Frame", if[++k] &, 15, {Right, Bottom}}]]
Original answer
An extension of the answer by Vitaliy. We can reproduce the Heike's style of torn edges with ImageEffect
of version 10.2 by Block
ing the Accumulate
function:
i = ExampleData[{"TestImage", "Mandrill"}];
t = Block[{Accumulate = RandomReal[1, Length[#]] &},
ImageEffect[i, {"TornFrame", Scaled[1/15], {Right, Bottom}, .08}]]
(the hack is found by tracing the evaluation of ImageEffect
).
Here is how to add a semi-transparent shadow:
offset = 10;
blur = 5;
shadowTone = .5;
ImageCompose[SetAlphaChannel[ColorNegate@#, #] &@Blur[
ImageMultiply[ImagePad[AlphaChannel[t], {{offset, blur/2}, {blur/2, offset}}],
shadowTone], blur],
ImagePad[t, {{0, offset + blur/2}, {offset + blur/2, 0}}]]
Sometimes it is desirable to highlight the boundary:
boundaryLigntness = .4;
ImageCompose[
SetAlphaChannel[ColorNegate@#, #] &@Blur[
ImageMultiply[ImagePad[AlphaChannel[t], {{offset, blur/2}, {blur/2, offset}}],
shadowTone], blur],
ImagePad[ImageMultiply[t,
ColorNegate@ImageMultiply[MorphologicalPerimeter@AlphaChannel[t], boundaryLigntness]],
{{0, offset + blur/2}, {offset + blur/2, 0}}]]