Jump to content

Make Jpeg Transparent


Recommended Posts

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...