Announcement

Collapse
No announcement yet.

Modifying image to remove background behind text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Modifying image to remove background behind text

    I'm a big IrfanView fan and have been using for many years.

    If I have a picture of a recipe in a newspaper for example, which just has text and no pictures, typically the background is non-white after the scan/photo.

    I would like to be able to make the background all white. That way if later printed there is no toner being used other than that for the text.

    Is there a way of modifying an image to achieve this?

    #2
    An easy way is to use Gamma correction and Contrast = Shift+G.

    Click image for larger version

Name:	Before.jpg
Views:	1
Size:	351.9 KB
ID:	83559Click image for larger version

Name:	After.jpg
Views:	1
Size:	320.0 KB
ID:	83560
    Last edited by Bhikkhu Pesala; 08.01.2021, 07:50 PM.
    Before you post ... Edit your profile • IrfanView 4.57

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Download the SmartCurve plugin. Draw a curve that compresses the highlights using a couple points. The resulting S-curve is similar to using a gamma/contrast adjustment, but you can more intuitively adjust how much to cut on the black and white ends separately, to balance between having the text jaggy and leaving some paper texture or reflection from the opposite side visible.

      https://www.softpedia.com/get/Multim...artCurve.shtml

      If you get text from the other side of a sheet visible while scanning, place a black paper, a bible or an organizer book behind the sheet to absorb some light.
      Attached Files

      Comment


        #4
        IrfanView comes with SmartCurve included

        Click image for larger version

Name:	iv_curve.png
Views:	1
Size:	16.4 KB
ID:	83565
        Last edited by jazzman; 09.01.2021, 01:13 PM.

        currently running 4.56 / 32 bit

        Comment


          #5
          I'd go another way to be absolutely sure to have a plain white background and use the colour replace tool of IrfanPaint.
          This way it is possible to replace each shade of grey colour with plain white. Use the tolerance to adjust the effect and
          a big value for Width (px).
          Win 10/64 Home 20H2 IrfanView 4.57/64
          Hate has caused a lot of problems in this world, but it has not solved one yet. (Maya Angelou)

          Comment


            #6
            Brightness, contrast and gamma correction works quite well. You can also make the text truly black.
            IrfanView 4.57 64bit, Windows 10 20H2

            Comment


              #7
              Originally posted by Kuki Dent View Post
              I'd go another way to be absolutely sure to have a plain white background and use the colour replace tool of IrfanPaint.
              This way it is possible to replace each shade of grey colour with plain white. Use the tolerance to adjust the effect and
              a big value for Width (px).
              That sounds great. But typically there are so many shades of grey, who can one pick them all? A pity there is not a "record macro" facility you can run to do common things like this on images.
              Last edited by boardtc; 11.01.2021, 02:28 PM.

              Comment


                #8
                Originally posted by Bhikkhu Pesala View Post
                An easy way is to use Gamma correction and Contrast = Shift+G.

                [ATTACH=CONFIG]6062[/ATTACH][ATTACH=CONFIG]6063[/ATTACH]
                This is really good for getting rid of the not grey colours it seems, thanks, but left lots of different shades of grey
                Last edited by boardtc; 11.01.2021, 03:15 PM.

                Comment


                  #9
                  Originally posted by j7n View Post
                  Download the SmartCurve plugin. Draw a curve that compresses the highlights using a couple points. The resulting S-curve is similar to using a gamma/contrast adjustment, but you can more intuitively adjust how much to cut on the black and white ends separately, to balance between having the text jaggy and leaving some paper texture or reflection from the opposite side visible.

                  https://www.softpedia.com/get/Multim...artCurve.shtml

                  If you get text from the other side of a sheet visible while scanning, place a black paper, a bible or an organizer book behind the sheet to absorb some light.
                  I was unable to understand these instructions, is there perhaps a YouTube demo available?

                  Comment


                    #10
                    All the comments here are good and will make the text in images show up much better. I've found that with a combination of Gamma Correction (Image > Color Corrections or Shift G) and Image > Replace Color, I can get somewhat good black text against a white background. It takes a good clean scan to begin with and then good bit of fiddling. In some places the text may not be clear, and I can then copy & paste words or just letters from elsewhere in the article. I've not tried Smart Curve.

                    I keep many recipes on a Recipes folder and have found that the easiest cleanest way is to OCR them and save them as word processor files (ie, Word .doc or .docx). With the scanned recipe image open in Irfanview, if necessary clean it up just so the text is clear. Then go to Options > Start OCR. A full page window (that I can't make smaller) opens with the text it recognizes. Drag your mouse over all the text you want and it will pop up in a Notebook type window so you can easily copy & paste it into a .doc file. Then edit it to fix any OCR errors and format it as you see fit. Once you get the hang of it, it's easier and faster. Doc files also print nicer than images.

                    An advantage of this is that you can also copy & paste any image into the doc file also.

                    If you don't have a Word Processor, Word Pad is part of Windows and is more than capable.

                    Good luck.

                    Comment


                      #11
                      I handle this two ways - Colour correction in Irfanview as described by others above or by using a program called Scantailor. Scan Tailor is being used not just by enthusiasts, but also by libraries and other institutions. Scan Tailor processed books can be found on Google Books and the Internet Archive.
                      It is freeware designed for converting books/magazines/etc to clean black and white but is severely lacking in documentation suitable for Dinosaurs like me, and, for me anyway, fails to process coloured and greyscale graphics on white backgrounds anywhere near as well as Irfanview does. It does however smooth out black on white text much better. To me the graphics are usually most important so if there are no graphics I use ST. I always finish in IV because I do not like STs despeckling and IV gives a better feel of what is visually wrong as the working area is double, Unlike IV it can dewarp and dekeystone scans.
                      The https://forum.diybookscanner.org// website and https://diybookscanner.org/ site have some good stuff related to what you are doing.

                      Comment

                      Working...
                      X