How to Replace a Color with Transparent

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

Moderators: XnTriq, xnview

Post Reply
engineerbill
Posts: 1
Joined: Fri Dec 17, 2010 6:35 am
Location: Oxnard, California, USA

How to Replace a Color with Transparent

Post by engineerbill » Fri Dec 17, 2010 7:00 am

This may be a silly question, but I'm a new user. I have a Windows BMP file that contains only a 4-bit color pallette. I'd like to replace black with transparent but can't figure out how to do it. The "enable transparency" checkbox under "edit color pallette" makes it tantalizing but I just don't get it. Help! :(

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

Re: How to Replace a Color with Transparent

Post by XnTriq » Fri Dec 17, 2010 10:45 pm

Welcome to the forum, engineerbill :-)
  1. Go to View » Display Colour Information
    » The mouse cursor turns into an eyedropper with a tooltip next to it.
  2. Move the color picker over the area of the image that you want to become transparent
    and remember the index number of the color beneath the cursor.
  3. Go to File » Export.
  4. Go to the tab for the format you want your image to be saved in.
    (For 4-bit indexed images, that would be GIF or PNG.)
  5. Click on the Set transparency color... button
    and select the color with the index number you identified earlier.
  6. Save the image.

tomilipin
Posts: 3
Joined: Sun Jul 28, 2019 5:10 pm

Re: How to Replace a Color with Transparent

Post by tomilipin » Sun Jul 28, 2019 5:33 pm

Hi,
I have a very similar problem, so I'm posting a reply here - I followed your instruction, XnTriq, but the Set transparency color button is inactive when the Color mode is set to 16m. I have to choose literally any other Color mode to enable the Set transparency color button, but then the image quality is visibly worse.

Converting image from its original True Color to 32 bits doesn't help. Actually, it makes things even worse as the file size increases from 45 MB to over 60 MB.

I'm working on a TIFF file with transparent background, which shows correctly in Windows 7 generic image viewer, but in XnView the background is white - no idea why...

I'm using XnView 2.48, Windows 7. Please help :|
inactivebutton.png
inactivebutton.png (122.36 KiB) Viewed 826 times

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

Re: How to Replace a Color with Transparent

Post by XnTriq » Tue Jul 30, 2019 3:30 pm

tomilipin wrote:
Sun Jul 28, 2019 5:33 pm
I have a very similar problem, so I'm posting a reply here - I followed your instruction, XnTriq, but the Set transparency color button is inactive when the Color mode is set to 16m. I have to choose literally any other Color mode to enable the Set transparency color button, but then the image quality is visibly worse.

Converting image from its original True Color to 32 bits doesn't help. Actually, it makes things even worse as the file size increases from 45 MB to over 60 MB.
Unfortunately I don't have a short answer for you as there are many different types of transparency.

tomilipin wrote:
Sun Jul 28, 2019 5:33 pm
I'm working on a TIFF file with transparent background, which shows correctly in Windows 7 generic image viewer, but in XnView the background is white - no idea why...
Could you upload the TIFF file to a hosting service so we can take a look?

tomilipin
Posts: 3
Joined: Sun Jul 28, 2019 5:10 pm

Re: How to Replace a Color with Transparent

Post by tomilipin » Tue Jul 30, 2019 4:52 pm

Hi,
I'm slowly starting to accept the white background - it doesn't ruin my project.

Anyway, here's the file: http://wikisend.com/download/927280/Zywiec.tif

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

Re: How to Replace a Color with Transparent

Post by XnTriq » Wed Jul 31, 2019 12:15 am

tomilipin wrote:
Tue Jul 30, 2019 4:52 pm
Anyway, here's the file: http://wikisend.com/download/927280/Zywiec.tif
Thank you for providing a sample, tomilipin. I've filed a bug report: Transparency is lost during conversion from CMYK to RGB

tomilipin
Posts: 3
Joined: Sun Jul 28, 2019 5:10 pm

Re: How to Replace a Color with Transparent

Post by tomilipin » Wed Jul 31, 2019 1:23 pm

Oh, so it's a bug... Well, in that case I'm glad I could help by unintentionally finding it :)
Thanks!

Post Reply