How do I save a png with transparent background

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

Moderators: XnTriq, xnview

Post Reply
mel2000
Posts: 4
Joined: Mon Dec 17, 2007 4:54 am

How do I save a png with transparent background

Post by mel2000 »

I'm new to XnView and can't get my pngs to substitute my white background with a transparency. The background remains white. In the png options I set transparency to palette entry 0 (whatever that means). Can someone tell me what I'm doing wrong? Thanks.
User avatar
Clo
XnThusiast
Posts: 4441
Joined: Sun Oct 17, 2004 4:57 am
Location: Bordeaux, France
Contact:

Colours count

Post by Clo »

:arrow: mel2000

:) Hello !

• It depends on which colour-depth you image is.

- With a 32-BPP image, tick the menu-item “View” >> Use alpha channel

- With a 4…8 BPP image (256 colours max.) you can use the menu-item “Image” >> Edit Colormap,
then set the transparent colour according to the dominant one of the background (here, white, IIUC) in the dialogue.
- Save the file when done…
…In the png options I set transparency to palette entry 0 (whatever that means). …
- This entry is also in the “View” menu now. I confess that I never understood that it means really… :P

:mrgreen: Kind regards,
Claude
Clo
Old user ON SELECTIVE STRIKE till further notice
mel2000
Posts: 4
Joined: Mon Dec 17, 2007 4:54 am

Post by mel2000 »

Thank you for your prompt reply Clo. I'm using version 1.91.6 and cannot find the alpha channel setting under the View menu. The only place I see to set png transparency settings is under Tools->options, which allows for the following:

PNG Read
Compose image with transparency (checked)
compose image with alpha (32bits) (checked)

Write
Set transparency value to palette entry 0 (checked)

Still, none of those entries set my white background to transparent.
User avatar
Clo
XnThusiast
Posts: 4441
Joined: Sun Oct 17, 2004 4:57 am
Location: Bordeaux, France
Contact:

View mode

Post by Clo »

:arrow: mel2000

:) Hello !

• These menu items are in the main window (“View” mode), not in the browser :

     Image

• Same for the Colormap item in the Image menu, it's also in “View” mode…
- That works here, maybe could you show a small sample ?
- Please, check too in the Option whether the chequered pattern as transparency is ticked or not :
Options >> View…
- Your images must be either 32 BPP or 8 BPP (and less), it seems that 24 BPP ones can't get the transparency
(neither colormap, nor Alpha channel…)

:mrgreen: KR
Claude
Clo
Old user ON SELECTIVE STRIKE till further notice
User avatar
XnTriq
Moderator & Librarian
Posts: 5616
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

mel2000 wrote:In the png options I set transparency to palette entry 0 (whatever that means).
Computer Desktop Encyclopedia: colormap = color look-up table = indexed palette

XnView v1.92 is due to be released this week. The new version will allow you to set transparency for non-palette-based (>256 colors) images.
  1. Download and install Guessous Mehdi's free Eraser Classic plug-in.
  2. Download xnview_full.png and open it in XnView.
  3. In View mode, go to Image » 32 bits.
  4. Then go to Filter » Adobe Photoshop Plug-In...
  5. In the Plugins manager, go to Mehdi, select Eraser Classic and click on the Start... button.
  6. In the Eraser Classic window, click on the eyedropper tool, move the mouse cursor over the white background in the preview on the left and click on it.
  7. Exit Eraser Classic by clicking OK.
  8. Exit the Plugins manager by clicking OK.
  9. Save the image in PNG format.
Forum references:
mel2000
Posts: 4
Joined: Mon Dec 17, 2007 4:54 am

Post by mel2000 »

Thanks for your replies Clo and XnTriq. When I tried to implement your advice I ran into a serious shortcoming in XnView that will not allow me to complete my task in that application.

I found the settings for the alpha option and they were already checked. But there was no option to allow me to set a transparent color as with most graphics apps, so I still couldn't save any transparency in my 32 bit images without using a plugin.

My task was to use batch processing to set the canvas size to a 25 px white frame all around each of 10 png images (to make them look like a Polaroid snapshot - I wish we could set each side individually). Then I wanted to add a drop-shadow with transparency behind each framed image. That's it.

1.) The first issue was that XnView wouldn't allow me to convert the 10 png images to 32 bit all at once. That cut down on my productivity considerably.

2.) The most serious shortcoming was that the drop-shadow's background color was always white (not the drop-shadow itself) and there was no way to change it. That prevented me from using the eraser plugin to make the drop-shadow's background transparent since the frames of the images were also white.

3.) The 32 bit pngs were saved as 24 bit after the batch processing. I had no option to retain the 32 bit setting.

I hope I'm missing something here but I was hoping for so much better from XnView.
Post Reply