Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fulvio

This plugin allows you to set the transparency for background colours of images, tilesets, etc that are not originally transparent.

/><br />
e.g: (The background hex color is #ff00ff)<br />
<br />
The plugin works by injecting into the base <code>ig.Image</code>, so you do not need to change much code. Whenever you are specifying the path to an image, simply append an #alpha:<hexcolor> to the end of the path. So for example:<br />
<br />
Change:<br />
<br />
<pre class= var img = new ig.Image( 'player.png' );
to:

var img = new ig.Image( 'player.png#alpha:ff00ff' );

If you want to set the player background to transparent.

The reason I use hash tags to specify the colour, is because:

- Your browser cache WILL be used to load the image again each time, which is good. We don't want to re-download the image every time there is a new background color.

- The ImpactJS cache will NOT be used between different background colors, which is also good (we don't want each background color to modify the same underlying image). The cache will only be used when referring to the same backgrounds (since the path will match, of course).

Link: Transparent Backgrounds

Note: This is based off the image blender code by Ptg:

Image Blender

1 decade ago by Kishore

There is an awesome tool in the web for adding background color to transparent images like png. check out the tool.. tool to add background color to transparent images
Page 1 of 1
« first « previous next › last »