How to make partially transparent png image buttons for iPhone?

My iPhone app has custom buttons displaying png images. I like to replace the white color on these images with a transparent color. Is there a tool on Mac that allows me to do this? (or is there another way to indicate which color is transparent in xcode?)

+4
source share
3 answers

The preview application has a mode in its Instant Alpha selection tool that makes it easy to select the background. After selecting the background image, you can simply press the “Delete” key and this area of ​​the image will be deleted. Save it as a PNG with the "Alpha" flag and you're done.

Most other image editing tools, especially those that support multiple layers in the image, will also correctly support PNG alpha channels. Most likely, it will be easier than using Preview, but they are all third-party and many of them cost money, so you will need to make this decision.

Please note that if you start with an image with a solid background, to which some things have a faded edge that merges with the background, it is unlikely that you can completely remove the background to your satisfaction without cropping the actual image.

You may have seen GIFs in the past that were designed to blend on a white background and had bright pixels at the edges that stood out and looked ugly on darker backgrounds. An image saved as PNG or any other format with an alpha channel from the very beginning will not have this problem.

+4
source

Just set the alpha image of the image.

- (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor=[UIColor greenColor]; //Set background color UIImageView *imgView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"images-4.jpeg"]] ; // Create and initialize imageView imgView.frame=CGRectMake(10, 10, 200,250);// Set frame for imageView [self.view addSubview:imgView]; imgView.alpha=0.1; //Adjust alpha } 

enter image description hereenter image description here

+3
source

Start with the png file (use the image preview).

You need to go to View> Show Edit Panel.

Then expand the window so you can see all the icons.

Then click the icon that looks like a magic wand.

And then click and drag the color you want to remove.

0
source

All Articles