Can i specify a color to be transparent - iphone

I have a UIImage, the background of it is white. I want the background of this UIImage to be transparent to its parent view. Is this possible?

One word answer- No. As robin said you have to use photo editing softwares to accomplish that. it cannot be done iphone(easily)..

I am not going to suggest that it is easy, but you should take a look at CGImageCreateWithMaskingColors, which is described in the Quartz 2D Programming Guide: Bitmap Images and Image Masks

You can't specify the transparency of a color from an image, but you could make a PNG image which has a transparency in the places you want it to be transparent.

Related

Iphone Set background image into text in uitextView?/

I have a uiimageView containing the text like this.
I want to set the image background of the text to look like this instead.
Please help me! Thanks!
You will need to combine an image of the text with the background image (the stuff that is supposed to fill the inside of the text) using compositing. Take a look at the various blend modes you can use, or look into the use of CIFilter.
http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGContext/Reference/reference.html#//apple_ref/doc/c_ref/CGBlendMode
https://developer.apple.com/library/mac/#documentation/graphicsimaging/Reference/CoreImageFilterReference/Reference/reference.html
The thing in the background looks like it might be a gradient. Again, you can use a CIFilter to generate that gradient, or you can use Core Graphics. So you'll composite the drawn text with its fill image, then you'll draw that over a gradient.
instead of text in black solid color, make image with transparent text and outer region as the grey gradient you want and put this image over you background image, you will get the desired result.

process brightness on specific part of image

I am creating an application in which i am displaying image view with image and processing brightness on the image using slider. I want that brightness should be done only on the selected part of image and not on the entire image.
I want the brightness should be processed only on the central part of the image without using openGl Image processing.
Please help me to solve this problem. Hey guys Please help me its important for me.
There are several ways to accomplish this. One is to overide the drawRect: UIView method and use a mask. Another is to draw the bitmap yourself in a CGContext. Yet another is with OpenGL.
What have you tried?

Why images in XIB are different?

At left there's the original image (after imported in Xcode), at right the image inside UIImageView. It's more dark.
Why this? It's a very annoying problem.
Man! Its just an illusion.
Don't ask "magic" related questions here. Ask only program related questions ;-)
Both images are of same color. They look different because their background colors are different. Use Photoshop or some other tool to find the colors of those two. They should be the same.
Its because the background colours are different and the stroke on the image is the same / similar colour to the background.
Change the background colour of the view to white, and it will look normal.

I want to exchange a particular color inside an image with another color. Is there any possible way?

I have one image with multiple colors.
I want to change a specific color with the alternate color that i have pre-decided.
Is there any algorithms to modify the image and save it?
Help is appreciated.
Thank you very much.
See the selected answer to this question:
How to make one color transparent on a UIImage?
It also shows turning red pixels green, which applies to your question.
Definatly yes.
Look here
Bitmap Images and Image Masks
Look in that page for: "Masking with color"

Convert an image to an iPhone toolbar icon

I have a grayscale icon that I'm editing with Photoshop with a transparent background, but I can't, for the life of me, figure out how to convert the icon to one that can be used as an iPhone toolbar icon. If I simply save the image as a PNG, it doesn't show up as anti-aliased on the iPhone because every pixel with color is being rendered as black, instead of a shade of gray.
According to the Apple docs and other sources, there needs to be an alpha channel on the image to specify varying levels of transparency for each pixel. However, I have no idea what that means. I've read these posts and docs from Adobe and I still can't figure out how to properly convert a grayscale image into one that can be used as an iPhone toolbar icon. The blog post is hard to comprehend and poorly written, and the Adobe docs don't really help.
http://cahit.hayalet.net/blog/514/converting-an-image-to-iphone-toolbar-icon/
http://livedocs.adobe.com/en_US/Photoshop/10.0/help.html?content=WS74B356C9-353F-4483-8632-7B1A102F2A2E.html
Can someone point me in the right direction or provide exact, step-by-step directions to doing this in Photoshop?
It's much more simple than having to muck with actual masks in Photoshop.
iPhone toolbar icons are about 30px by 30px, so make a new Photoshop file with those dimensions. Ensure the background is transparent (you can specify that when creating a new file).
Then, any pixels you draw on top of this transparency become what iOS uses for the icon. Doesn't matter what color it is in Photoshop for NSToolbar icons -- they're automatically used as masks by iOS.
Leave transparent the parts you want to show through. Save as 24-bit PNG, and chuck into XCode as usual.
For a few icons that serve as good starting examples, check out the ones I publish for free here: http://glyphish.com Just take one of the PNGs and open it in Photoshop and you'll see that it's drawn in an arbitrary color (#444444) with varying levels of opacity to create darker and lighter parts of the icon.
This is more of a photoshop question than coding but anyway, here's a suggestion.
Lunacore has a good tutorial on how to use masks.
What you want to do is:
Make sure you're background is transparent.
Create a new layer and
fill it with any solid color.
Create a mask on the solid color
layer, and fill your greyscale image into the mask. (Use your
greyscale image as the mask.)
Toolbar icons use your image as a mask. They only consider what transparancy the image has. Not what color or shade.