Results 1 to 5 of 5

Thread: Wrong transparent color when saving in PNG format

  1. #1

    Default Saving transparent PNGs (feature request - look post #5, bug was not confirmed)

    Hello!

    I found a bug in PNG saving module (same for PNGOUT PlugIn). When manually selecting transparent color, it's determined incorrectly.

    For example:

    Click image for larger version. 

Name:	1.png 
Views:	357 
Size:	41.7 KB 
ID:	4008

    Actual color in corners is 128 128 128 RGB (or it can be any other), but IrfanView detects it as 149 148 171 RGB:

    Click image for larger version. 

Name:	2.png 
Views:	276 
Size:	13.4 KB 
ID:	4009

    If manually change color in TweakPNG to correct values:

    Click image for larger version. 

Name:	3.png 
Views:	260 
Size:	13.4 KB 
ID:	4012

    Then all becomes ok:

    Click image for larger version. 

Name:	4.png 
Views:	306 
Size:	41.6 KB 
ID:	4015

    I noticed this only, when choosing transparent color in window corners, in other cases seems, that all normal.

    I use IrfanView 4.38, full installation with all plugins, OS Windows XP SP3.

    Hope, that you will fix this issue.
    Last edited by ViewFan; 23.12.2014 at 03:44 AM.

  2. #2

    Default

    Any comments?

  3. #3
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,152
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    I couldn't reproduce it. The area to click is far too small to know which pixel was selected. I suspect there's some anti-aliasing in those corners. The bug seems too trivial to be worth following up. Anyone can send bug reports to Irfan directly if they wish.

  4. #4
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,763
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    IMHO you should not bother Irfan with this. You are trying to do some fairly advanced things and I think you need to learn a bit more about Irfanview before assuming that it is a bug.

    Lesson 1. If you want to work with tiny areas then learn how to zoom in. All my examples show your first image with the zoom wound up to 800%. The one immediately below illustrates the first lesson. If you want to look at colors at this zoom level you must not resample. Resampling invents new colored pixels to smooth the transitions between the original colors. Great for photographs and small web pictures when you want them to look like a slightly out of focus version of a much higher resolution photo but useless to see what the original colors were. So uncheck that "Use resample for zooming" before you start winding up the magnification.

    Click image for larger version. 

Name:	Do not resample.png 
Views:	226 
Size:	59.8 KB 
ID:	4019

    Lesson 2. Understand the transparency options. At the top of the Viewing tab of Properties/Settings is the option to either turn on or off the transparency of those image types that support both single color and Alpha layer transparency. That includes PNG files. If that box is unchecked as in the left hand image below you will not see any transparency. Instead you will see the original color - the one that you clicked on to select as transparent when you saved it. Now you can see that the color of those corners is a solid (128, 128, 128) over the whole of the tiny triangles.
    If the box is checked as in the right hand image below transparency is turned on. What you will see in the transparent areas is the Main window color underneath the image. The color is set at the bottom of the Viewing tab and you see I chose a bright purple. You have just 3 transparent pixels. I would say that you missed the corner when you clicked to select the transparent color.
    Note that you have to save a new transparency option by closing the dialog after changing it and then reload the image before it takes effect.

    Click image for larger version. 

Name:	Not transparent.png 
Views:	228 
Size:	61.9 KB 
ID:	4020 Click image for larger version. 

Name:	Is transparent.png 
Views:	729 
Size:	59.4 KB 
ID:	4021

    Lesson 3. Use a workaround. However much you wind up the zoom in Irfanview, the size of the image you click on to set the transparent color is fixed, and too small to select areas as small as those corners accurately. You can try using a magnifier tool to see what you are doing a bit better but you can only magnify what is on the screen and sometimes you still get it wrong. You have an alternative though. You know that you want to make (128,128,128) transparent, so set the main window to that color and in the PNG Save options choose "Use main window color for transparency" instead of "Save transparent color". Make sure that you change the main window color back to a good contrasting color before you check the result though or you will think it has not worked.
    Last edited by Mij; 20.12.2014 at 10:28 PM.

  5. #5

    Default

    Quote Originally Posted by Mij View Post
    I would say that you missed the corner when you clicked to select the transparent color.
    Hell, you right! I really missed the corner (and I did it many times before), because, as it turned out, mouse cursor not accurately points to the pixels (I have Windows XP SP3 with standard 3D-White mouse theme):

    Click image for larger version. 

Name:	1.png 
Views:	226 
Size:	22.9 KB 
ID:	4023

    And I have to set cursor to one pixel left or upper, than it actually points, to choose correct transparent color.

    Quote Originally Posted by Mij View Post
    size of the image you click on to set the transparent color is fixed, and too small
    Yes, and this is a big lack of the program which must be filled. We need a feature of viewing image in this window in full resolution with ability to move it (resizing actually is not so necessary, since it will not help with big images).

    And I tried also your workarounds with magnifier tool and "main window color". They working great.

    Thanks for all your tips and comprehensive answer. Good luck!
    Last edited by ViewFan; 22.12.2014 at 04:34 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •