How to create a faded image using an existing image file

The question is simple:

How can I take an image of a perfect stamp (load an image file) such as

and make it look old, worn, and faded, with missing arbitrary small bits, like the following stamp

Any suggestions?

• @Kuba For me it does not matter if it is a stamp or a photo. All I want is to load an image file (.bmp, .png, .jpg, etc) and remove arbitrary small bits from it, thus making it look old and worn. Nov 10 '17 at 15:23
• @Kuba Please see my edit! Nov 10 '17 at 15:48
• Thanks and sorry for being picky :)
– Kuba
Nov 10 '17 at 16:34
• @AccidentalFourierTransform Done! Thank you! Nov 11 '17 at 16:52

You could try something like this:

img = Import["https://i.stack.imgur.com/hf1aj.png"]


create some random noise and smooth it, to make the "dirt grains" smoother:

noise = ImageAdjust[
GaussianFilter[RandomImage[{0, 1}, ImageDimensions[img]], 2]]


Then binarize that noise, using MorphologicalBinarize:

binary = MorphologicalBinarize[noise, {.6, .7}]


This produces fewer, larger "grains" than simply using Binarize.

Now subtract that image from the alpha channel in your image:

SetAlphaChannel[img, ImageSubtract[AlphaChannel[img], binary]]


You can play around with the filter size and the binarization thresholds to get different "graininess":

rnd = RandomImage[{0, 1}, ImageDimensions[img]];
Manipulate[
SetAlphaChannel[img,
ImageSubtract[AlphaChannel[img],
MorphologicalBinarize[
{{s, 2}, 0, 10}, {{t1, .6}, 0, 1}, {{t2, .7}, 0, 1}]


Given that your image already has an alpha channel, I would try to reduce the opaque mask on the "stamp" that already exists by multiplying the alpha channel by some selected noise.

Here are a few examples:

im = Import["https://i.stack.imgur.com/hf1aj.png"];

Create flatly random noise in a size half that of the image, then scale. This rescaling reduces pixelation and helps to remove sections rather than just one-off pixels:

ColorCombine[ColorSeparate[im]*{1, 1, 1, ImageResize[RandomImage[1, {100, 100}], {200, 200}]}, "RGB"]

This one is going to use isolated pixels, but has good contrast since it's using SaltPepper noise:

ColorCombine[ColorSeparate[im]*{1, 1, 1, ImageEffect[ConstantImage[White, {200, 200}], {"SaltPepperNoise", 1/3}]}, "RGB"]

I think my favorite is a resize of GaussianNoise:

ColorCombine[ColorSeparate[im]*{1, 1, 1, ImageResize[ImageEffect[ ConstantImage[White, {100, 100}], {"GaussianNoise", 2/3}], Scaled[2]]}, "RGB"]

Of course you can play with the noise type and the starting image size to get what matches what you want best.

• When I try the first method with another image I get the following error message: "ColorCombine::ccbinput: should be a list of images with the same image dimensions." Nov 10 '17 at 16:39
• I also get the same error message when I try the exact same image of the example. Nov 10 '17 at 16:41
• Hmm. Weird. What does ImageDimensions /@ (ColorSeparate[im]*{1, 1, 1, ImageResize[RandomImage[1, {100, 100}], {200, 200}]}) say? Nov 10 '17 at 16:42
• I cannot reproduce neither of the three methods. I tried in v9 and v11 with no luck. In all three of them the ColorCombine module complains about the dimensions. Nov 10 '17 at 16:55
• It sounds like you're on a version before the regular arithmetic functions were extended to images. That's fairly recent. Nov 10 '17 at 17:02