How can I create an image with a transparent background?

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

Moderators: XnTriq, xnview

Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I save an image with a transparent background?

Post by Elk »

I had no problem, but it is on a Windows 10 laptop so I prefer not to use it
Sorry, what does that mean? I also have a Win 10 notebook.

Thank you for the screenshot. Yes, it is shown correctly here after downloading it:
Image

Is the transparency already shown / recognizable in the preview? Or only after saving and opening it (in XnView)?

It seems to work a bit but looks pretty ugly:
Image
cday
XnThusiast
Posts: 3084
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How can I save an image with a transparent background?

Post by cday »

Elk wrote: Sat Mar 06, 2021 7:00 am
I had no problem, but it is on a Windows 10 laptop so I prefer not to use it
Sorry, what does that mean? I also have a Win 10 notebook.
I use Linux now as I hate Microsoft for its business practices and flaky Windows 10 :( .

Is the transparency already shown / recognizable in the preview? Or only after saving and opening it (in XnView)?
In XnView Classic everything looked normal, although different from in XnView MP in some respects.

It seems to work a bit but looks pretty ugly:
Image
As above, image resolution and range of colours used, but it may look a bit better at normal scale than zoomed in.
cday
XnThusiast
Posts: 3084
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How can I save an image with a transparent background?

Post by cday »

One thing you could do, preferably from a better starting point, would be to clean up the image by removing stray pixels.

You can delete small areas of the image, or change the colour of other areas, by making a small selection around a clean area of the image, copying the selection to the clipboard, then making a selection around an area that you want to change and pasting the clipboard onto that selection.

A useful enhancement technique that can be used to clean, or otherwise edit, a bitmap image when the time required can be justified, try it to see how it works.
Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I save an image with a transparent background?

Post by Elk »

Yes, Micro is not the best, like - I guess - most of such huge companies.
One thing you could do, preferably from a better starting point, would be to clean up the image by removing stray pixels.
OK, good idea. And, that brings me to another idea, couldn't I just increase the contrast or make the image brighter generally so some grey (and / or not pure white colors) get real single white?
cday
XnThusiast
Posts: 3084
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How can I save an image with a transparent background?

Post by cday »

Elk wrote: Sat Mar 06, 2021 8:37 am Yes, Micro is not the best, like - I guess - most of such huge companies.
One thing you could do, preferably from a better starting point, would be to clean up the image by removing stray pixels.
And, that brings me to another idea, couldn't I just increase the contrast or make the image brighter generally so some grey (and / or not pure white colors) get real single white?
Maybe, whatever works, but to get a good result it is best to start with a reasonable image, and if you want transparency the range of colours in the final image needs to be limited, otherwise some colours are likely to be missing in the transparent version.

In your image above you have both blue and white pixels which won't work, you need at the most different shades of blue.
Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I save an image with a transparent background?

Post by Elk »

Now I made it, took another template / jpg. With 16 colors it worked.
In your image above you have both blue and white pixels which won't work, you need at the most different shades of blue.
But why different shades of blue? I thought the most important is to get the background color (here white) clear, without different shades of white, so a single white. So that XnView recognizes how to set the transparency, to make only the single white area transparent.
cday
XnThusiast
Posts: 3084
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How can I save an image with a transparent background?

Post by cday »

You need the background to be a pure enough colour to be recognised in the reduced colour palette, but you are right that all the other colours in the reduced palette will be present in the transparent image.

But to get a signature that looks realistic you will normally need a consistent colour, in your screenshot above the 'signature' itself has blue and white pixels; it isn't actually transparent yet? Note that you should be able to use XnView MP if you select 16 rather than 8 colours.

- - - -

When you have a better image you might find that applying a filter, such as maybe enhance focus, slightly enhances that image.

Another completely different approach, on which I can't give advice, might be to vectorise the signature to produce a smooth outline, maybe using a software like the freeware Inkscape. But then you would have to consider how you intend to use the signature, which hasn't been discussed.
Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I save an image with a transparent background?

Post by Elk »

But to get a signature that looks realistic you will normally need a consistent colour, in your screenshot above the 'signature' itself has blue and white pixels;
That screenshot shows the result after saving to png (from jpg). The writing is only blue, a blue pen. The background actually pure / a single white (a sheet of paper, DIN A4). So actually the writing must be pure blue, the background pure white, two colors. Yes, now it looks transparent:
Image
Another completely different approach, on which I can't give advice, might be to vectorise the signature to produce a smooth outline, maybe using a software like the freeware Inkscape. But then you would have to consider how you intend to use the signature, which hasn't been discussed.
You mean, in what programs? I want to try use it in pdfs, docs, odts, so pdf / writing programs. I assume, with the image / signature saved with XnView this will work. So actually this should be enough.
cday
XnThusiast
Posts: 3084
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How can I save an image with a transparent background?

Post by cday »

Elk wrote: Sat Mar 06, 2021 10:05 am That screenshot shows the result after saving to png (from jpg). The writing is only blue, a blue pen. The background actually pure / a single white (a sheet of paper, DIN A4). So actually the writing must be pure blue, the background pure white, two colors. Yes, now it looks transparent:

Image
That should look reasonable when viewed at a smaller size, provided the number of pixels remains the same... :D

Another completely different approach, on which I can't give advice, might be to vectorise the signature to produce a smooth outline, maybe using a software like the freeware Inkscape. But then you would have to consider how you intend to use the signature, which hasn't been discussed.
You mean, in what programs? I want to try use it in pdfs, docs, odts, so pdf / writing programs. I assume, with the image / signature saved with XnView this will work. So actually this should be enough.
Have you given any thought to how you will do that, a rather basic point...

In a word processor document you could place the image in a box, but what about adding it to a PDF?
Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I save an image with a transparent background?

Post by Elk »

That should look reasonable when viewed at a smaller size, provided the number of pixels remains the same... :D
Yes, I dragged and dropped the image over an open odt in LibreOffice and it appears to look good:
Image
Have you given any thought to how you will do that, a rather basic point...

In a word processor document you could place the image in a box, but what about adding it to a PDF?
That is very easy, obviously. Like above, drag and drop or copy and paste (both to any position or into a box or else) or create a text correction entry or in PDF XChange there are "Stamps" you can add your signature to and then just drag it form there to the place it shall be. So doing the same like one does with a stamp so to say.
User avatar
XnTriq
Moderator & Librarian
Posts: 5922
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: How can I create an image with a transparent background?

Post by XnTriq »

Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I create an image with a transparent background?

Post by Elk »

Thank you.

I am not able to give a proper signature with a mouse, I am afraid. And I do not have a touchscreen, drawing pad or a digital pen.

I cannot believe that using a common (handwritten) font for one's name one entered with the keyboard legally can be used as an official signature.
User avatar
XnTriq
Moderator & Librarian
Posts: 5922
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: How can I create an image with a transparent background?

Post by XnTriq »

Elk wrote: Sat Oct 02, 2021 6:16 amI am not able to give a proper signature with a mouse, I am afraid. And I do not have a touchscreen, drawing pad or a digital pen.
There are/were a bunch of Photoshop-compatible plug-ins (.8bf) for “converting” areas of a certain color to alpha-channel transparency. The ones based on Filter Factory v3.0 require msvcrt10.dll. On Windows 10, they cause XnView to crash. Hopefully this can be fixed.

p172535.png

  • Mac's Remove White (Filter Factory)
    “makes white pixels transparent, partially white pixels partially transparent. Good for illustrations.”
  • KillWhite (FilterMeister)
    ”is a Photoshop Filter that actively removes white from an image (unlike the ‘Multiply’ blend mode), perfectly leaving the rest of the image, whether the image is black-and-white or color. However, this is not simple masking. Pixels that are partly transparent are altered so as to only remove the white portion. Shadows and gradients will remain in the image, only white is removed.”
  • Eraser Classic (FilterMeister)
    “allows to erase easily a given colour. A typical use: activate the eyedropper, select the colour directly in the preview window, and adjust tolerance.”
  • Eraser Genuine (FilterMeister)
    “modifies image transparency according to two criteria: a colour you wish to erase and a colour you wish to protect. So, this plugin is particulary suitable for images where two colours oppose clearly.”
  • Pngyu
    “is simple PNG image file compression tool. Pngyu use pngquant as a compression engine.”
You do not have the required permissions to view the files attached to this post.
Elk
Posts: 143
Joined: Wed Feb 27, 2019 6:17 pm

Re: How can I create an image with a transparent background?

Post by Elk »

I do not have / use Photoshop (but Lightroom).

Thank you for the links.

OK, I will try that out.
User avatar
XnTriq
Moderator & Librarian
Posts: 5922
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: How can I create an image with a transparent background?

Post by XnTriq »

Elk wrote: Sat Oct 02, 2021 10:06 amI do not have / use Photoshop (but Lightroom).
You'll need a 32-bit host application (XnView Classic, XnView MP x86 or a 32-bit version of Lightroom) for these plug-ins to run.
XnTriq wrote: Mon Jun 14, 2021 4:00 pm
BuckSkin wrote: Sat Jun 12, 2021 10:08 pmWhere, in XnViewMP, should 8BF plugins go ?
The plugins subfolder of your Classic and/or MP installation(s) is where the I/O plug-ins (for file formats not natively supported by XnView) go.
XnTriq wrote: Tue Nov 22, 2016 8:15 pmTo prevent possible conflicts Photoshop-compatible filters shouldn't be placed in any of the “special” subdirectories of your XnView installation. (I keep all filters in %CommonFiles%\Plug-Ins\ so I can point host applications to that folder.)
You have to tell XnView where you keep your Photoshop-compatible filters (*.8bf):
  • Classic: ToolsOptions…Sytem integrationAdobe PluginsAdd…
  • MP: ImageAdobe Photoshop Plugin…Configure…
XnTriq wrote: Tue Nov 22, 2016 1:15 amThe 32-bit edition of MP requires 32-bit 8BFs, and the 64-bit version needs 64-bit plug-ins.

Another example: 97347668.jpg

Pngyu.png
KillWhite.png
MACWHITE.png
You do not have the required permissions to view the files attached to this post.