Define base10 RGB alpha channel for Racket 2htdp/world - racket

I have an image pulled from a tileset that I am using in a Racket 2htdp/world program.
I can grab the tile I want, but the background is not an enumerated name, like blue. I want the "hollow" pixels to be the same color as the background without editing the tileset with an image editor.
Is there a way to make color in the image transparent by specifying the RGB value?

I want the "hollow" pixels to be the same color as the background
Then you need to use mask as transparent can be both transparent and in background color.

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.

How to mask image with color in iOS?

Basically I want to remove the background color of image from image.
that why I want to mask my image with clear color, it can make the image transparent.
or do we have any other way to clear the backgrund color of image and get transparent image.
Create a new image with by masking background using CGImageCreateWithMaskingColors. Specify the background color range(RGB) values. That would be enough to create background transparent image.

Iphone App Color to black&White Image RGB Value

Currently i am working on Iphone app similar to http://itunes.apple.com/us/app/color-splash-free/id385504846?mt=8 in which we can make some or full portion of pic as black and white.
Please check the attach image for more detail.
I just want to know that how i can start it.I am familiar with paint app.Is this any rgb Value of any color or Its gray scale overlapping of an image with actual image at background or hide some portion of actual image and show grayscale image in that part.
Please share any code if you have that.
Thank you
Can't offer a concrete answer but a general approach from doing something similar.
What you have in 32 bit image is 4 channels of pixel information: red pixels, green pixels, blue pixels and alpha value for each pixel.
A gray image as you know from using any paint program is when all three colour components red, green and blue have equal intensity value.
E.g.
rgb value of (0.5,0.5,0.5) would be halfway between black and white.
What I can suggest is you looking into finding where the user tap the screen, take rectangular sample of pixels from the touch point into memory loop through all the sample pixels and set their red, green and blue value to be equal, then redraw the newly modified image onto the view again.
If you want to quickly convert an entire image to grayscale, you can use GPUImageFramework by Brad Larson? (apologies if I misspelled your name Brad :P).
You can use his GrayScaleFilter class to generate a grayscale image.

How to create an art asset that can be dynamically colored in software?

I asked this question on the Graphic Design site, but it includes a programming component that might be better answered here.
Specifically, I have a bunch of photographic crayon images. I would like to remove the color from one to produce a neutral image that I can load into an iPhone app that I'm writing and dynamically color. The crayon images have dark regions (shadows) and light regions (shine) which I would like to preserve. I will be dynamically coloring it with many different colors, ranging from white to rainbow colors to black.
My first inclination is to turn the image into a grayscale image and then somehow turn the color channel into an alpha channel, and change the color of all pixels to black. Then I could use it as a mask. However, this would only preserve the shadows, and I would lose all the highlights.
Any ideas?
Two options come to mind:
Make a grayscale version that could be tinted as you said, with the shadows and highlights simply white and gray.
Make an outline, i.e. an image with alpha that had 0% opacity in the colored parts, say 10% white over the highlights, 10% black on the shadows, and 100% black/dark gray for the lines/edges. The idea being that you could put any color under the outline and it would look right.

Alpha blending on the edges of an UIImage

I have two rectangular images: one is foreground, the other one is background. I am trying to blend the edges of the foreground image so that the foreground image looks like it is "part" of the background image. In other words, I am trying to apply a transparency effect, with the opacity of the foreground image decreasing from 100% at the center of the image down to 0% at the edges. I have found that this operation is sometimes referred by different names, such as: alpha compositing, alpha blending, edge feathering or edge transparency. Here is a more detailed description of the effect I am trying to obtain: http://en.wikipedia.org/wiki/Alpha_compositing
I have looked at the CGContext documentation, but I haven't found any function that would do that out of the box.
Is there any way to do that using CGContext or even OpenGL? Would there be a way to do it on a non-rectangular image? I know, all images are rectangular, but I mean an image with let's say, a circle in it, and a transparent area all around.
The CGImageCreateWithMask() function in the iOS library can do alpha blending with decreasing opacity on the edges. It's possible to get something to work by combining the code in these two links:
http://iosdevelopertips.com/cocoa/how-to-mask-an-image.html
Creating mask with CGImageMaskCreate is all black (iphone)
The level of gray (from black to white) of each pixel in the mask will define the level of opacity during blending.