2

I have images of old paintings. The paintings are old and dusty with faded colours as shown here.

How do I give any image this type of an 'old' appearance? I couldn't find any filters or openCV functions to achieve this type of look?

EDIT: My question is different as the other one solves the problem using the sepia filter and using the grain effect. I'm not looking for that sort of an appearance. I want my image to look like an old damaged painting. This means that the colours should be faded and it should have an overall dusty appearance.

mjsxbo
  • 2,116
  • 3
  • 22
  • 34
  • 1
    Possible duplicate of [how to get the "old picture" effect in openCV?](https://stackoverflow.com/questions/5699297/how-to-get-the-old-picture-effect-in-opencv) – user366312 Aug 16 '18 at 21:37

3 Answers3

5

There's no real need to write any code and use OpenCV, since you can do all that on the command-line with ImageMagick which is installed on most Linux distros and is available for macOS and Windows.


First, fading. This can be simulated by reducing the saturation of an image. So if we start with this Mona Lisa image:

enter image description here

We can fade her using this command to leave the brightness unchanged at 100% of its original value and reduce the saturation to 50% of its original value. I am intentionally "over-egging" everything so you can see it clearly. You should maybe be more subtle.

convert mona.jpg -modulate 100,50 result.jpg

enter image description here


Next, vignetting - or dark corners. You can use something like this:

convert mona.jpg \
   \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x15+1+1% \) \
   -compose multiply -composite result.jpg

enter image description here

The 0x15 controls the roll-off, or how gradual the change is, so increase the 0x15 if you want a smoother roll-off or go down to 0x5 if you want it harder. The +1+1% means that the ellipse will be 1% smaller than the width of the image and 1% smaller than the height of the image. So if you want a smaller light hole and bigger dark corners, go for +10+10%. The degree of darkening is controlled by the gray(50%) so you can diddle with that till you are happy too :-)


Finally, dust. Best thing is to get a PNG image of some dust, resize it to match the size of your image and overlay it.

First get the size of Mona:

identify mona.jpg
mona.jpg JPEG 403x600 403x600+0+0 8-bit sRGB 57130B 0.000u 0:00.000

So, she is 403x600. Here is a sample of some dust - again, you can be more subtle - I am just being heavy-handed so it shows:

enter image description here

Let's resize the dust to match and overlay it:

convert mona.jpg \( dust.png -resize 403x600\! \) -composite result.jpg

enter image description here


Then you can combine all three effects, fading, vignetting and dust, into a single command:

convert mona.jpg -modulate 100,50% \
   \( +clone -fill white -colorize 100 -background "gray(50%)" -vignette 0x15+1+1% \) \
  -compose multiply -composite     \
  \( dust.png -resize 403x600\! \) -composite result.jpg

enter image description here

If you have lots of images to process, you can script the whole lot to be done in parallel very easily with GNU Parallel - see some of my other answers for examples.

Keywords: artificial ageing, image ageing, command-line, command line, ImageMagick, magick, old, old photo, photo effect, convert, dust, scratches, fading, faded.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
0

I would suggest using a style transfer tool, rather than manually coming up with a procedure to mimic the style of an old painting. There are plenty free style transfer tools and libraries available.

Paul92
  • 8,827
  • 1
  • 23
  • 37
  • Thanks! I tried style transfer on one image using an online tool and it works exactly as I want. Though I have a pretty large dataset and I need to do this on all the images. Can you recommend me some good function or library I could use to automate this over my entire dataset? – mjsxbo Aug 17 '18 at 06:06
0

I would suggest using OpenCV various filters to create the effect you need. You have to try various filters and try to figure what works for you, But I have suggestions which you can try.

For color, fading try Erode and Dilate with small kernel size. Next, add some noise, Salt and Pepper will do just fine, also try gaussian filter after applying noise. Salt and Pepper is non-linear noise and Gaussian is a linear filter so it will just spread the noise, but keep the filter kernel small.

Try finding some images of dust, torn page edges (WITHOUT BACKGROUND) like in the following link: https://www.google.co.in/searchq=dust+png+images&newwindow=1&rlz=1C1CHBF_enIN797IN798&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjtq7ZvfPcAhXJO48KHQ2UD0kQ_AUICigB&biw=1536&bih=759#imgrc=_

Keeping alpha transparency in mind, mask these over your images.

With all the things in correct proportion and sequence, You will get your old dusty image.

  • Your link is broken (404). Also, dilation and erosion have little to do with color fading. What is the logic there? – Cris Luengo Aug 19 '18 at 13:06