Edit Background Color for .png files

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, xnview

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Edit Background Color for .png files

Postby c627627 » Wed Jan 11, 2017 10:36 pm

For .jpg files, this works:
Edit > Background Color > Choose white as the color that is visible after only a part of a picture is deleted.

But for .png files, selection of background color has no effect. Gray remains the color for the part of the picture that gets deleted for .png files.

Can we set Background Color for .png files?


EDIT: [RESOLVED]:
XnView > Tools > Options > Read/Write > Read TAB > PNG > CHECK: Compose image with alpha (32bits)
Last edited by c627627 on Fri Jan 13, 2017 9:27 pm, edited 2 times in total.

cday
XnThusiast
Posts: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Edit Background Color for .png files

Postby cday » Wed Jan 11, 2017 10:43 pm

c627627 wrote:For .jpg files, this works:
Edit > Background Color > Choose white as the color that is visible after only a part of a picture is deleted.

But for .png files, selection of background color has no effect. Gray remains the color for the part of the picture that gets deleted for .png files.

Can we set Background Color for .png files?

No problem for me with a 24-bit PNG, are you possibly using 32-bits files?

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Wed Jan 11, 2017 11:27 pm

Yes. My screenshot software saves 32-Bit .png files.
Does that mean it is not possible to set the background color for 32-Bit .png files?

cday
XnThusiast
Posts: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Edit Background Color for .png files

Postby cday » Wed Jan 11, 2017 11:35 pm

c627627 wrote:Yes. My screenshot software saves 32-Bit .png files.
Does that mean it is not possible to set the background color for 32-Bit .png files?

You can't create 24-bit images?

Regarding 32-bit PNGs, that's a question for XnTriq...

Edit:

If you don't have transparency, couldn't you convert the images to 24-bit and then make the deletes you need?

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Thu Jan 12, 2017 12:23 am

Screenshot software set to default takes png screenshots...
They appear to be 32-Bit.

We need to be able to very quickly simply white out a small part of that standard screen shot.


Or else I am forced to open the screenshot in Photoshop and do it that way.
What would it take to make the default background color at least be white for all files, including 32-bit .png, can that be done?
Would you not agree that white is the most natural background color, color of paper. Gray is not.

Luckily we can set white for jpg (default color for jpg is not white, by the way, I have to go in with each XnView installation and change it to white, but at least we can do that for .jpg files).

User avatar
XnTriq
Moderator & Librarian
Posts: 5089
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Edit Background Color for .png files

Postby XnTriq » Thu Jan 12, 2017 3:15 am

Please make sure to set Edit » Background colour... (in view mode) to R255/G255/B255 before “flattening” the PNG screenshots with Image » True Colour to get rid of the alpha channel.
BTW: I find the checkerboard background very helpful for identifying transparency in images.

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Thu Jan 12, 2017 3:26 am

All right.
The additional step of
Image > True Color accomplishes this and is the answer to this thread's question.

Thank you.

For informational purposes, what exactly happens to the original file when you Image > True Color it?

User avatar
XnTriq
Moderator & Librarian
Posts: 5089
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Edit Background Color for .png files

Postby XnTriq » Thu Jan 12, 2017 3:30 am

c627627 wrote:For informational purposes, what exactly happens to the original file when you Image > True Color it?

The color depth is decreased fom 32-bit (RGBA) to 24-bit (RGB). Transparency is lost due to the alpha channel (the A in RGBA) being discarded.

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Thu Jan 12, 2017 4:08 am

What would it take for XnView to handle 32-Bit and is it likely it will have this feature added at any point?
In other words, is what is involved so complex, that XnView is unlikely to really ever be able to handle it?

User avatar
XnTriq
Moderator & Librarian
Posts: 5089
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Edit Background Color for .png files

Postby XnTriq » Thu Jan 12, 2017 4:45 am

c627627 wrote:What would it take for XnView to handle 32-Bit and is it likely it will have this feature added at any point?
In other words, is what is involved so complex, that XnView is unlikely to really ever be able to handle it?

I'm not aware of any issues in that regard.

  • If you select part of a 32-bit image and hit delete (= Edit » Clear), the area turns transparent and the viewer's background color (Tools » Options... » View » View » Background colour) becomes visible in that spot.
  • If you select part of a 24-bit image and hit delete, the area is filled with the color specified in Edit » Background colour....

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Fri Jan 13, 2017 5:59 pm

Here's are my conclusions on this issue: People may not really understand what it means to Image > Remove Alpha Channel and they might they think by doing that they "lose" the quality of the original image... But the reality is, 10/10 times, it's editing an image that is not important.

So...would it be reasonable to have some sort of a non-default setting, where a user can switch on a setting that would trigger the removal of that Alpha Channel automatically when you select part of a 32-Bit .png and press DELETE... what do you think?

The big picture being, what all this is about, is super-quick whiting-out of just a part of a 32-Bit screen shot .png file.

User avatar
XnTriq
Moderator & Librarian
Posts: 5089
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Edit Background Color for .png files

Postby XnTriq » Fri Jan 13, 2017 7:30 pm

c627627 wrote:So...would it be reasonable to have some sort of a non-default setting, where a user can switch on a setting that would trigger the removal of that Alpha Channel automatically when you select part of a 32-Bit .png and press DELETE... what do you think?

Usually I would've recommended activating Ignore alpha channel (Tools » Options... » General » Operations), but things can get very confusing in some cases for people who aren't used to working with 32-bit images. Case in point: 1.png & 2.png :-|

UPDATE: Forget about Ignore alpha channel. Please activate » Compose image with alpha (32bits) in Tools » Options... » Read/Write » Read » PNG.

c627627
Posts: 41
Joined: Fri Jun 26, 2009 5:00 am

Re: Edit Background Color for .png files

Postby c627627 » Fri Jan 13, 2017 9:27 pm

Perfect, perfect.

XnView > Tools > Options > Read/Write > Read TAB > PNG > CHECK: Compose image with alpha (32bits)


Thank you!

User avatar
XnTriq
Moderator & Librarian
Posts: 5089
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Edit Background Color for .png files

Postby XnTriq » Sat Jan 14, 2017 1:30 am

8) :D


Return to “Classic - General Support”

Who is online

Users browsing this forum: lascetic and 1 guest