Backgrounds when removing alpha channel

XnConvert Multi Platform - Windows, MacOSX, Linux

Moderators: XnTriq, helmut, xnview

Post Reply
mtg45
Posts: 3
Joined: Sat Dec 19, 2015 3:46 pm

Backgrounds when removing alpha channel

Post by mtg45 »

When you convert PNG with alpha channel to JPG without it, the final JPG has fragments that would otherwise be hidden by the alpha channel.

I'd like to ask for an action, or setting to configure backgrounds for images that originally had alpha channel.

Or, tell me how to do that in the current 1.71, in a case I missed it somehow :)
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Backgrounds when removing alpha channel

Post by XnTriq »

Welcome to the forum, mtg45 (-:

Adding an extra action to change the color depth to truecolor before converting 32-bit PNGs to JPEG should do the trick.
mtg45
Posts: 3
Joined: Sat Dec 19, 2015 3:46 pm

Re: Backgrounds when removing alpha channel

Post by mtg45 »

Hm.., yes, the artifacts are now gone, but it doesn't allow me to change the background. It'll always be white.

But, good enough for most of the cases I guess. Thank you :)

Edit: I have to add though that this is in no way intuitive, and unless told I wouldn't be able to figure this out. Specific action that handles background behavior for alpha channel removal would be amazing.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Backgrounds when removing alpha channel

Post by XnTriq »

IMO, this feature should be added to all versions of XnView (including XnConvert and NConvert).
XnTriq ([url=http://newsgroup.xnview.com/viewtopic.php?p=55999#p55999]Loading GIF, removing transparency, saving JPG[/url]) wrote:
xnview ([url=http://newsgroup.xnview.com/viewtopic.php?p=31842#31842]Convert PNG -> JPG, transaprency is black[/url]) wrote:
Gordon wrote:I am trying to convert PNGs with transparency to JPG, but the transparency is always black. I woudl like ti to be white. I have tried the -transpcolor option but I didn't do anything.

If it possible to set the transparency color converting to JPG?
Is this syntax correct?

... -out jpeg -transpcolor 255 255 255 -keepcspace -q 100 ...
You can't change the transparency color when saving in jpeg
Danny
Posts: 575
Joined: Sat Sep 04, 2004 5:09 pm

Re: Backgrounds when removing alpha channel

Post by Danny »

Bump.

It would be really helpful to somehow be able to select which color the transparency will have, if the output format doesn't support transparency (JPG, ...). Otherwise, you'd have to do it in two passes (first convert to lossless format without transparency, then convert to JPG by replacing BG color), which sucks.

It could even be a program-wide setting like the preview background color.
Get the bugs fixed, THEN start adding features. It sucks, but someone has to do it.
Post Reply