Announcement

Collapse
No announcement yet.

Problem reading transparent GIFs

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

    Problem reading transparent GIFs

    I am using IrfanView 4.25, but I have seen this bug from 3.92 upwards (and I believe it was started even earlier).
    I have a GIF with my company logo and its background is transparent.
    When I open this GIF into IrfanView - it does not recognize the transparent color and allways forces it to BLACK.
    You will say that I can choose a transparent color when I save the GIF back - but then arises the real problem, because I have BLACK areas in my logo already.
    So, when I try to save this GIF back - IrfanView allows me to set a transparent color by clicking. And I click on the background - but since it is now black (because of the wrong behaviour of IrfanView when loading the file in the beginning), as a result my logo has now transparent background AND the original black areas (the name of the company) are now ALSO transparent.
    When I load/save the same GIF with another tool (Pixel Editor) - the transparent background is properly preserved.
    I have tested other GIFs and ICOs - and each time the transparent color is silently converted to black by IrfanView.

    You can check yourself using this address
    http://crm.walltopia.com/test/images/menu/logo.gif
    Attached Files

    #2
    The background colour for transparent images in IrfanView is set in Properties, Viewing, main window colour. The default is black, but you can change it to whatever you want.

    There is no checkerboard pattern to display transparency, as there is in Photo-editing programs.

    The transparent "colour" is not changed on loading transparent images. IrfanView only support 24-bit palettised transparency, not 32-bit alpha transparency, so it is not suitable for editing 32-bit icons.
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Okay, if what you are saying
      "The transparent colour is not changed on loading transparent images."
      is true - then on saving it should retain/preserve that transparent colour, right ?
      But it does not - it forces me to choose:
      1. Eigher click inside the image - and select a NEW transparent colour
      2. Or press "ESC" to ignore transparency at all

      I do not bother for checkerboard pattern - but I do want that IrfanView does not change the transparent colour to its main window colour. If it HAS to change the colour (which I think is not a very wise behaviour) - then why it "forgets" to restore it back when I try to save the image ?

      I do not know how IrfanView works - but probably it is similar to this:
      1. Non-paletted images are loaded as they are
      2. Paletted images are first internally converted to a non-paletted one
      I suppose that in this internal conversion the transparent colour is lost and the main window color is used instead.

      My suggestion is - let IrfanView compute an unused 24-bit RGB colour (certainly there would be one for every possible picture in the world) and
      use it instead of the main window colour.
      Then when I save my image - I can click on this colour and be sure that it will not destroy any other colour in the image.

      Does this sound very hard to implement or it just does not worth (it worths for me) ?

      Comment


        #4
        IrfanView is loading the file as a bitmap in memory. If you want to change the background colour, open IrfanPaint (F12) and use the flood-fill tool.

        If you want to edit images extensively, perhaps IrfanView is not the right tool for you — it is an image viewer at heart. I would regard alpha transparency as a basic requirement of a photo-editor.
        Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

        Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

        Comment


          #5
          Originally posted by Bhikkhu Pesala View Post
          IrfanView is loading the file as a bitmap in memory. If you want to change the background colour, open IrfanPaint (F12) and use the flood-fill tool.

          If you want to edit images extensively, perhaps IrfanView is not the right tool for you — it is an image viewer at heart. I would regard alpha transparency as a basic requirement of a photo-editor.

          I do not want to edit images extensively. Most of the time, I am using IrfanView for one of these:
          1. Convert between image formats
          2. Resize / resample images
          3. Decrease color depth

          Therefore, if I should set the main window background colour to an unusual value every time I load transparent image - I will consider this an extra difficulty for the user in favor of more easy / lazy programming.
          As I already suggested - IrfanView could be modified to behave differently when loading transparent image (to temporarily change the background colour of main window to some other colour, which is not used in the image being loaded).

          But probably, as you said - IV might not be the right tool to convert between images ...

          Comment


            #6
            Originally posted by tmcdos View Post
            Okay, if what you are saying
            "The transparent colour is not changed on loading transparent images."
            is true - then on saving it should retain/preserve that transparent colour, right ?
            But it does not - it forces me to choose:
            1. Eigher click inside the image - and select a NEW transparent colour
            2. Or press "ESC" to ignore transparency at all
            It is rather bizarre. The only way I know of preserving the transparent color is to go to Image >Palette > Edit Palette and click on a transparent bit of the image (where the background canvas is showing through). That will highlight and display the palette entry number that was being used as the transparent color and is now displaying as canvas. Make a note of that number and when you save, check Set transparency value to palette entry and fill in the number you wrote down.

            If you do save using that option then next time you open the image in Irfanview you will see that it shows the number of the transparent color under Compression: in the Image Information.

            Clearly Irfanview must know which palette entry it replaced with canvas when it opened and IMHO should default to the Set transparency value.. option and fill in that entry number for you automatically when you save.

            Comment


              #7
              Originally posted by Mij View Post
              Clearly Irfanview must know which palette entry it replaced with canvas when it opened and IMHO should default to the Set transparency value.. option and fill in that entry number for you automatically when you save.
              This is exactly what was in my mind but I could not say so well as you (English is not my native language) !

              Comment


                #8
                I agree about this color definition to be saved in the palette dialog.
                0.6180339887
                Rest In Peace, Sam!

                Comment


                  #9
                  This is why I use an odd shade of blue-gray for background. It seldom matches anything important in an image. I like a black background, but when I open black-and-white images with transparency -- Oy!
                  Its: Belongs to "It"
                  It's: Shortened form of "It is"
                  ---------------------
                  Lose: Fail to keep
                  Loose: Not tight

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

                  Comment


                    #10
                    Yes, that's a good idea Matera. Using a distinctive color for the background means that you can select Choose transparent color during saving when you want to resave and easily find a transparent bit of the image to click on then.

                    I see that it does not matter either if you do have that same color somewhere else in the image since that will have been saved already under a different palette entry number and will not become transparent.

                    By the way, I should not have used the term Canvas in my earlier posts. It is the Main window color as set in the Viewing section of Properties/settings that forms the background and is seen in the transparent areas. Canvas can be set to a different color in the Add canvas dialog.
                    Last edited by Mij; 04.12.2009, 02:25 PM.

                    Comment


                      #11
                      Okay, until the Mij suggestion is implemented in IrfanView, the workaround seems to be:
                      1. Use an odd Main window color
                      2. Read the transparent color palette item from the Image information dialog
                      3. Use the Set transparency value to palette entry option when saving

                      Comment


                        #12
                        Hello again tmcdos
                        I think perhaps you did not quite understand my last post following Matera's message.

                        An easier way is
                        1. Use a distinctive background (Main window) color. When you open the image the areas that were transparent are clearly seen filled with that background color.

                        2. When you save again select Choose transparent color during saving

                        3. When the Choose transparent color window appears click in an area within the image that is filled with the background color. That color then becomes the transparent color for the saved image.

                        It has the advantage that you can edit the image with less risk of losing the identity of the transparent color. You can also keep the transparent color while converting between GIF and PNG formats.

                        Comment


                          #13
                          Thanks again, Mij.

                          Hopefully, next IrfanView version will contain your suggested behaviour

                          Comment

                          Working...
                          X