Jump to content

Make Jpeg Transparent


Vishal Gupta
 Share

Recommended Posts

How to make jpeg transparent(i think it can be done with bitmap data but how)? In the attached image i just need a clock image without black background the process i am thinking is make the second frame jpeg bitmap transparent and mask the first frame.

20-clock-closed.jpg

Link to comment
Share on other sites

I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/

You can get just as good results with png compression as jpeg.

EDIT:

I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.

Link to comment
Share on other sites

7 hours ago, JakeCake said:

I agree with matt; transparency in png is a built in mask, so why overcomplicate? If you like the compression-rate of jpeg over png I suggest you take a look at some good png-compression like on https://tinypng.com/

You can get just as good results with png compression as jpeg.

EDIT:

I myself use a gulp task to take my loseless PNG-files and combine them into texture atlases and then pipe them into a compression task using gulp-pngquant. So I am always working with uncompressed png-files, but the final build will be compressed based on settings I can always change for quality over size. For my next project I might even move to working purely with photoshop files and have a task to convert my photoshop files into pngs.

Thanks for the reply and the way you guys suggests.

although i am able to do this thing by using Phaser Bitmap data. by using replaceRGB with changing black or white color to any color with alpha 0.

var sprite = new Phaser.Image(game,0,0,'clock',1);
var sprite2 = new Phaser.Image(game,0,0,'clock',0);
var bmd = game.make.bitmapData(53,40);
bmd.load(sprite);
bmd.replaceRGB(0, 0, 0, 255, 0, 0, 0, 0);
var bmd1 = game.make.bitmapData(53,40);
bmd1.alphaMask(sprite2,bmd);
game.add.image(400, 0, bmd1);

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...