Background with Partial Transparency

Top  Previous  Next

To specify a background with partial transparency, you need to use RGBA (not RGB) or HEX color formats, which have a 4th value added - the degree of transparency.

In RGBA, transparency is specified by a number from 0 (transparent) to 1 (opaque): 0 corresponds to 0%, 0.5 - 50%, 0.8 - 80%, 1 - 100%. For example, in the color rgba(230,230,230,230,0.5) the transparency value is 0.5.

In HEX format, transparency is expressed using hexadecimal numbers. For instance, in the color code #E6E6E6E680, the 80 at the end represents the transparency level, which indicates 50% transparency.

Transparency codes for hexadecimal format are presented at the end of the document.

As previously mentioned, to achieve backgrounds with transparency, processed files should be created in PNG or TIFF formats.

An example for a folder containing source files in PNG format:

The D:\1in folder contains images in PNG format: 001.png, 002.png, 003.png. Let's start processing the D:\1in folder and set a semi-transparent light blue background color using the -b key.

RGBA (transparency value - 0.5 corresponds to 50%)

>idrembg --in-dir "D:\1in" -b rgba(208,227,239,0.5)

HEX (transparency value - 80 corresponds to 50%)

>idrembg --in-dir "D:\1in" -b #D0E3EF

As a result, the following processed files will be created in the D:\1in folder: 001.idrembg.png, 002.idrembg.png, 003.idrembg.png with semi-transparent light blue background.  

MANUAL~1_img24

 

An example for a folder containing source files in JPEG format:

The D:\1in folder contains images in JPG format: 001.jpg, 002.jpg, 003.jpg. Let's start processing of the D:\1in folder and set a partial transparent light blue background color using the -b key.

Add the --output-format key with the value png so that the processed files will be created in PNG format.

RGBA (transparency value of 0.5 corresponds to 50%)

>idrembg --in-dir "D:\1in " -b rgba(208,227,239,0.5) --output-format png

HEX (transparency value - 80 corresponds to 50%)

>idrembg --in-dir "D:\1in" -b #D0E3EF --output-format png

As a result, the processed files in PNG format (which we specified with the --output-format key) will be created in the D:\1in folder: 001.png, 002.png, 003.png with a semi-transparent light blue background.

MANUAL~1_img25