Question

Posted by Glen on June 17, 2010, 4:41 p.m.

So I'm making a program atm, and I was wondering if there's a way to save part of the screen to an image file and delete a particular color in the process. For example, there's a red circle on the screen and there's a white background. I want to save the circle as a .png and remove the white background so it's transparent. (Just an example). Anyone know of a way to do this?

My main reason for needing this is, i'm making a program that makes gamertags and the border is a rounded rectangle. I want to be able to save it so the transparent corners make the tag look nice on a forum signature no matter what the forum's background color is. Some forums have a white text area, others a shade of gray. I don't want white corners appearing on the image if it's on a gray forum, etc…

Comments

Ferret 14 years, 5 months ago

Download an image editor like gimp. Open the image and erase the corners you don't want (gimp can be annoying sometimes so make sure to add an alpha channel) Hell you could just use the GM8 image editor, that has transparency.

Glen 14 years, 5 months ago

The program I'm making is meant to make it easy for them and do it for the person.

Glen 14 years, 5 months ago

I want to be able to do it in-game.

OBELISK 14 years, 5 months ago

I have a question as well. Are you by chance Glenn Danzig?

Glen 14 years, 5 months ago

No, I'm not. Never heard of the name.

rufus 14 years, 5 months ago

oh shazbot

Cesque 14 years, 5 months ago

I never tried manipulating images with GM, but my wild bet would be no "no, you can't do that." The default in-game editor doesn't handle transparency, and I don't think GM itself can do that during image saving (I may be wrong, though - the help files and google are your friends).

Mordi 14 years, 5 months ago

Well, you have all sorts of create_sprite_from_screen and surface-functions. To remove select pixels I can only think of getting color-information about every pixel in the image and drawing on top of those pixels before saving it.

Acid 14 years, 5 months ago

Use external image files.

Glen 14 years, 5 months ago

@Acid how would using external image files help me delete a background color from a sprite that I created from the screen and save it as a .png file?