Displaying transparent img

Hi!
Ive been working on a few games that require non rect images, but i dont have any tool to make transparent images :frowning: i only have default programs of Win10, and i dont want to download some large programs.
I am looking for a free simple-mid advanced img editor, preferably if it is allready in Win10 by default.

Thx

1 Like

You don’t need a pre-made tool. You can write code now! You can make your own tool!

String filename = "yourfile.png";

size(400,400);
PImage img = loadImage( filename );
PGraphics pg = createGraphics( img.width, img.height );
pg.beginDraw();
pg.clear();
img.loadPixels();
for( int i = 0; i < img.pixels.length; i++){
  if( img.pixels[i] != color(255,0,255) ){
    pg.stroke( img.pixels[i] );
    pg.point(i%pg.width, i/pg.width);
  }
}
PImage done = pg.get();
done.save( "done.png" );
exit();

EDIT: This was something I just had handy - looking at its working now, I can see there’s room for improvements… Anyway, just have a bright pink background, and this will turn it transparent. Great for making, say, sprites for games.

Sample image you can try it on:
pinkbigham2

2 Likes

As far as I know, Windows 10 doesn’t have any tools that can make transparent images by default.
As for a small image editor that can, I suggest Pinta. It’s small, great, and starts up instantly, i.e. comparable to MS Paint.
Just start it up, load your image up, select Eraser(shortcut key E), and start making holes!
If you don’t like anti-aliasing, or its size, you can change both at the panel ontop.
Then, save as .png file, done!

Or, you can make your own tool, like mentioned above.

1 Like

Thx a lot! :slight_smile: but I wonder if 255,0,255 proceessing renders like transparent? And are there any online tutorials for pinta?

I think you misunderstood… The above code will take an image that has no transparency and make an image based on it that does have transparency. The pixels that you want to be transparent should be bright pink in the starting image - in the resulting image they will be completely transparent.

So processing will take any 255,0,255 and render it transparent?

Yes. Of course you can pick a different color to make transparent if you like - just edit the above code. I mean, if your image has hot pink ( which is color(255,0,255), you know?) pixels in the sprite, you don’t want those to be transparent, right? The point I’m trying to make is that you have the ability to do what you want by using Processing. You actually can set pixels to transparent, yourself, via a small amount of code. You don’t need any additional tools or programs to do it.

1 Like

Thx a lot :slight_smile: sry for all the nonsence u had to go through :frowning: I understand it now.
Bye

Just tested it… AND IT WORKS :slight_smile: