Announcement

Collapse
No announcement yet.

Creating a Truly Transparent Image

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

    Solved Creating a Truly Transparent Image

    I have a JPG of my signature that I would like to use a document. However, I cannot seem to make it transparent.

    Here's what I have tried.

    Open JPG in Irfanview.
    Click File > Save as
    Select PNG as file type.
    Click "Save"
    Click on the white background.

    However, when I insert it into a document, it blocks what's behind it.

    Can someone show me what I did wrong?

    Thanks.

    #2
    The "white" background in a jpg image is rarely one single colour.

    Open the IrfanPaint plugin (F12) and use the flood-fill tool to fill the background with cyan or another colour so that you can see what is being filled. Adjust the toerance to fill more colours that are close to the pixel that you click. When you're satisfied with the result, save as a PNG.
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Another approach is to reduce the number of colors in your document using the Riot plug-in. Open your JPG and select File > Save for web. If the dialog asks if you want to reduce the image size (and you do not want to), just reply No.
      Select PNG, and Xiaolin Wu quantisation method on the right. Reduce the number of colors in steps 256 - 128 - 16 in the "Color reduction" drop down while watching the right hand image view to see how far you can go without losing the range of colors that you need to keep. You can fine tune the number of colors in the "Reduce colors to" box below, remembering to press Enter after each change.
      When you have gone as far as you can in reducing the number of colors, Save the new PNG image. Then open the PNG in Irfanview. It is instructive to have a look at the color palette of the PNG image in Irfanview using Image> Palette> Edit Palette to check that you now have only one single color in the area you wish to make transparent.
      Finally resave the image selecting the transparent color as you originally did.
      Last edited by Mij; 23.09.2012, 09:13 PM.

      Comment


        #4
        Originally posted by Mij View Post
        Another approach is to reduce the number of colors in your document using the Riot plug-in. Open your JPG and select File > Save for web. If the dialog asks if you want to reduce the image size (and you do not want to), just reply No.
        Select PNG, and Xiaolin Wu quantisation method on the right. Reduce the number of colors in steps 256 - 128 - 16 in the "Color reduction" drop down while watching the right hand image view to see how far you can go without losing the range of colors that you need to keep. You can fine tune the number of colors in the "Reduce colors to" box below, remembering to press Enter after each change.
        When you have gone as far as you can in reducing the number of colors, Save the new PNG image. Then open the PNG in Irfanview. It is instructive to have a look at the color palette of the PNG image in Irfanview using Image> Palette> Edit Palette to check that you now have only one single color in the area you wish to make transparent.
        Finally resave the image selecting the transparent color as you originally did.
        I tried your second method and it seemed to work. However, when I went back and opened the PNG, I got a negative image.

        The palette showed one white and several black and gray blocks.

        When you say, "...resave the image selecting the transparent color as you originally did", can you be more specific? Thanks.

        Comment


          #5
          Originally posted by pikov22 View Post
          I tried your second method and it seemed to work. However, when I went back and opened the PNG, I got a negative image.

          The palette showed one white and several black and gray blocks.

          When you say, "...resave the image selecting the transparent color as you originally did", can you be more specific? Thanks.
          He means just click the white area and this time the entire thing should be saved as transparent, but a word of worning -- you will not be happy with the results: these grey colours are going to show up as an ugly whitish "glow" around the darker signature & and removing them will leave the finally result as a blocky pixellated mess ... what you really want is alpha-channel transparency to antialias the lines. It's easy enough in a full powered photo-editing program like photoshop, paintshop or the GIMP (reverse luminance your image as a mask over a black background and collapse it), but WAAAAAY beyond what even a great image viewer can ever hope to do for you...

          Comment


            #6
            Originally posted by invisifan View Post
            He means just click the white area and this time the entire thing should be saved as transparent, but a word of worning -- you will not be happy with the results: these grey colours are going to show up as an ugly whitish "glow" around the darker signature & and removing them will leave the finally result as a blocky pixellated mess ... what you really want is alpha-channel transparency to antialias the lines. It's easy enough in a full powered photo-editing program like photoshop, paintshop or the GIMP (reverse luminance your image as a mask over a black background and collapse it), but WAAAAAY beyond what even a great image viewer can ever hope to do for you...
            Thanks. I tried to follow the instructions in GIMP but the terminology was confusing.

            Comment


              #7
              I would guess that you reduced the number of colors too far pikov. It is quite easy to forget to press enter after each time you reduce the number of colors in the "Reduce colors to.." box of the Riot dialog. If you do so then the right hand preview image is not updated and what you save as your PNG image is not what you saw in the preview.

              You cannot set a transparent area in the Riot plugin so if you want that feature you have to open the saved image again in Irfanview and save it from there with the PNG save option "Save transparent color" checked.

              In practice you do not usually need to reduce the number of colors as far as I told you to do. The objective is to leave just one shade of "white" in the palette but you cannot check that until you open it again in Irfanview and select "Edit palette".
              It's a pity that you cannot do the color reduction entirely in the Irfanview window without using the Riot plugin but IMHO the color reduction algorithm there is nowhere near as good as the Xiaolin Wu one in Riot for this sort of work.

              Comment


                #8
                Thank you. I found a simple tutorial for GIMP and did the conversion there.

                Comment


                  #9
                  .
                  Thanks Mij

                  I just see your post .. very useful. I used a transparency macro (via Macroscheduler) -hampered by the great number of colours-
                  Now that would be much more simple.
                  Especially with text
                  .

                  Comment


                    #10
                    A quick way to homogenize the jpg background is to use the color replacer feature of the IrfanPaint plugin, with the tolerance level set so it barely catches the palest grays at the edges of the dark part. Another quick and dirty fix that works with some images is to adjust the gamma and contrast, but this destroys any subtle gradations in the darks as much as color reduction.
                    Its: Belongs to "It"
                    It's: Shortened form of "It is"
                    ---------------------
                    Lose: Fail to keep
                    Loose: Not tight

                    ---------------------
                    Plurals do not require apostrophes

                    Comment

                    Working...
                    X