For details, see How to Use.
A Simple Tool for Making Specific Colors Transparent
This program is a lightweight VCSSL-based tool that opens an image file, replaces a specific color with transparency, and saves the result.
» Looking for the batch processing version? Click here!
If you're making your own game or website, you've probably run into situations where you want to make the background of an image transparent.
Most graphic editing software supports this kind of operation, but if you frequently do simple conversions like "make green transparent," it can be a hassle to open the software, go through menus, apply transparency, and save the file each time. That's why this program was created as a simple tool focused on that one task.
Sponsored Link
How to Use
Download and Extract
At first, click the "Download" button at the above of the title of this page by your PC (not smartphone). A ZIP file will be downloaded.
Then, please extract the ZIP file. On general environment (Windows®, major Linux distributions, etc.), you can extract the ZIP file by selecting "Extract All" and so on from right-clicking menu.
» If the extraction of the downloaded ZIP file is stopped with security warning messages...
Execute this Program
Next, open the extracted folder and execute this VCSSL program.
For Windows
Double-click the following batch file to execute:
For Linux, etc.
Execute "VCSSL.jar" on the command-line terminal as follows:
java -jar VCSSL.jar
» If the error message about non-availability of "java" command is output...
If You Run Out of Memory While Running the Program...
Depending on how you use it, this program may consume a considerable amount of memory. As a result, the default memory allocation may not be sufficient in some cases. If you encounter such issues, please refer to the following:
» When You Run Out of Memory While Running the Program (for Microsoft® Windows® Users)
» When You Run Out of Memory While Running the Program (for Linux® and Other OS Users
Note: As a rough estimate, when processing a photo with a resolution of 4288 x 2848 pixels (about 12 megapixels), allocating around 3 GB (≈ 3000 MB) of memory should be sufficient for the program to run.
Selecting a File
When you launch the program, a file selection window will appear. Choose the image file you want to process and make part of it transparent.
As a sample, there's a file named sample.png included in the folder you downloaded and extracted. Try selecting that one first. It's a simple image of a person drawn over a green background.

Note: This tool only makes colors that exactly match the specified color transparent. It is not suitable for JPEG images, because JPEG's lossy compression causes color variation ("noise") that prevents an exact match.
Use PNG or BMP files instead, and make sure the color you want to make transparent is uniformly filled.
Specifying the Color to Make Transparent
After selecting the file, you'll be prompted to input the color to make transparent. Instead of entering a color name, you'll be asked to input the red, green, and blue (RGB) values, each from 0 to 255.
If you're not familiar with RGB values, check out the page below. It includes an explanation and a handy color display tool:
For example, to make the green in the sample image transparent, you would enter: Red = 0, Green = 255, Blue = 0.
Saving the Transparent Image (Automatic)
Once you've entered the target color, the tool will automatically save a new version of the image with that color made transparent.
The new file's name will be the same as the original, but with "_clear.png" appended to the end. The output format will be PNG.
Here's the result of running the tool on the sample image. As you can see, the green background has been made transparent, and the gray behind it is now visible.

A Batch Version for Multiple Files Is Also Available!
If you have a lot of images to process, repeating the steps above for each file can get tedious. In that case, try the batch version of this tool, which processes all PNG images in a folder and saves the results to another folder:
Simple Tool for Making Specific Colors Transparent (Batch Version) | |
![]() |
This version loads all PNG images in a folder, replaces the specified color with transparency, and saves the results to a separate folder. |
Code Overview
This program is written in VCSSL.
If you want to replace the color with something other than transparency, you can modify the source code in the file ColorToClear.vcssl using any text editor.
Since VCSSL is a scripting language, no separate compiler is needed-just edit and run. Its syntax is C-like and very simple, so if you're familiar with C or similar languages, you should find it easy to understand.
Full Code
Let's take a look at the full source code:
That's it! Just under 40 lines of code. Each part is briefly explained in the comments, but in the next section we'll go through it in a bit more detail.
Header Section
Let's start with the first two lines of the code:
The first line declares that the file is encoded in UTF-8. While the program will usually work fine without this line, including it helps prevent character corruption (garbled text).
The second line imports the Graphics library, which provides functions for handling graphics data -- in other words, image data. In VCSSL, image files are opened, displayed, or drawn by loading them into a data structure called a "graphics resource."
Selecting a File and Creating a Graphics Resource
Next is the part where we open the image file:
The choose(...) function prompts the user to select a file and returns the selected file's path as a string. We store this path in the variable "inputFilePath".
Then we pass that file path to the newGraphics(...) function, which opens the image file and loads it into memory as a graphics resource. This is how the image is made available for processing.
The newGraphics(..) function returns an ID number assigned to the newly created graphics resource, which we store in the integer variable "inputGraphics".
This ID allows us to distinguish between different graphics resources -- especially important later, when we create the modified image.
Defining the Replacement Color (Transparent)
Here's the section where we define the replacement color -- i.e., the color that will replace the specified one:
These variables define the red, green, blue, and alpha values of the new color. If you want to replace the specified color with something other than transparency, modify these values as needed.
By default, "toAlpha" is set to 0 to make the result fully transparent (0 means completely transparent, 255 means completely opaque).
For example, if you change "toGreen", "toBlue", and "toAlpha" to 255 and run the program:

As shown, the green parts are replaced with cyan instead of being made transparent. (In RGB, cyan is made by combining full green and full blue.)
Creating the Modified Graphics Resource
Now we get to the core operation: replacing the color in the image. It's handled by simply calling newGraphics(...) again, this time with more arguments:
When called with these arguments, newGraphics(...) creates a new graphics resource by copying the original one and replacing the specified color (fromRed, ..., fromAlpha) with the new color (toRed, ..., toAlpha).
The resulting resource is assigned an ID number, which we store in "outputGraphics". We'll use this later when saving the file.
Saving the File
Now for another important step: saving the result to a file:
We create a new filename by appending "_clear.png" to the original. This avoids overwriting the original file.
Then we call "exportGraphics" to save the modified image as a PNG file, and use "popup" to show a completion message including the saved file path.
Finishing Up
Finally, we clean up the graphics resources and exit the program:
deleteGraphics(...) releases the graphics resources from memory. Although these would be released automatically when the program exits, we do it explicitly here as a good practice.
Then we call exit() to end the program. (Without this line, the console would remain open until manually closed.)
That's all for the code!
License
This VCSSL/Vnano code (files with the ".vcssl" or ".vnano" extensions) is released under the CC0 license, effectively placing it in the public domain. If any sample code in C, C++, or Java is included in this article, it is also released under the same terms. You are free to use, modify, or repurpose it as you wish.
* The distribution folder also includes the VCSSL runtime environment, so you can run the program immediately after downloading.
The license for the runtime is included in the gLicenseh folder.
(In short, it can be used freely for both commercial and non-commercial purposes, but the developers take no responsibility for any consequences arising from its use.)
For details on the files and licenses included in the distribution folder, please refer to "ReadMe.txt".
* The Vnano runtime environment is also available as open-source, so you can embed it in other software if needed. For more information, see here.
Simple Tool for Viewing and Converting Between RGB Values and Color Codes |
|
![]() |
Display and Convert RGB Values and Color Codes on a GUI Tool |
A Simple Tool for Making Specific Colors Transparent (Batch Processing Version) |
|
![]() |
Batch-Convert a Specific Color to Transparency in All PNG Files in a Folder |
A Simple Tool for Making Specific Colors Transparent |
|
![]() |
Convert a Specific Color to Transparency in PNG Image Files |
Simple Tool for Animating Sequential Images |
|
![]() |
A lightweight tool developed with VCSSL that allows you to play back sequential image files as an animation without converting them into a video file. |
Vertex Array-Based Model Deformation Animation |
|
![]() |
How to Deform 3D Surface Models Using a Grid-Based Vertex Array |
Creating a Model from a Vertex Array (Quadrangle Grid Mesh Format) |
|
![]() |
How to Create 3D Surface Models from a Grid-Based Vertex Array |