How can I change every color in a UIImage to gray? [closed] - objective-c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I'm trying to create a mask from an image with a transparent background. I want to create a new UIImage where any pixel that has > 0 alpha to turn gray.

You can load an image with rendering mode UIImageRenderingModeAlwaysTemplate which draws the image as a template image, ignoring its color information.
[[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
Then set the tintColor of the container to gray
yourImageView.tintColor = [UIColor grayColor];

Related

How to remove a grey shadow from a JPEG? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
So in Photoshop we all know it's relatively easy to remove a white background from a .jpg image if the contrast is quite visible.
The problem with this image though is it has a grey shadow at the bottom of the image that is reliant on the white background, and therefore once it becomes transparent the shadow looks nasty.
What would be the best approach to remove this once the white background had been removed?
Thanks
https://s15.postimg.org/k2itasu7v/i_Stock_104502239_LARGE.jpg
You can use the Polygonal Lasso Tool. Manual removing.
Zoom to the shadow, select it with the Polygonal Lasso Tool > Right click and : Refine the edge + give it a bit of Feather and paint using the background color of the image.

Background color is seen while performing dojo transition [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
There is a problem in my app.I am using worklight v 6.0 and dojo framework.For testing i am using galaxy tab 2 . There is a white space coming between two header when transition occurs. What should i do to resolve this problem.
By reducing the width of the first page you can reduce this error.
Hi
The background color is set to header color. So that when the transition happens the white screen is not seen.

Create Image programmatically in Objective-C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to know is it is possible to create a blank image programmatically in Objective-C (Mac osx)? My requirement is I want to create a watermark, so one source image is there.. But i need to create an another image and add some text to that image and bind the second image with the first one so that it will display as a watermark. Is it is possible to create an image like that? i know how to merge two images. I don't know how to create an image programmatically and add some text on it.
You can create a blank png using:
// The NO here is the opaque parameter. You can set it to YES according to your needs.
UIGraphicsBeginImageContextWithOptions(CGSizeMake(150, 150), NO, 0.0);
UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
u can create image like this, hope this helps u ..
NSImage *blackImage = [[NSImage alloc]initWithSize:NSMakeSize(22, 12)];
[blackImage lockFocus];
NSColor *blackColor=[[NSColor blackColor]autorelease];
[blackColor set];
NSRectFill(NSMakeRect(0, 0, 22, 12));
[blackImage unlockFocus];
[item setImage:[blackImage autorelease]];//now you can get the black image hear item is imageView this is without ARC code u can remove autorelease if u want

matplotlib subplot with image background [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
how can I create a subplot, where the background is created fully, without a gray boundry, with a png image from file.png
I have tried:
import matplotlib.pyplot as plt
im = plt.imread('map.gif')
implot = plt.imshow(im,aspect='auto',origin='lower')
fig0=implot.figure.tight_layout(pad=0.5)
implot.axes.set_axis_off()
fig1=implot.figure
ax1=fig1.add_subplot(2,2,1)
ax1.plot(range(10))
ax2=fig1.add_subplot(2,2,2)
ax2.plot(range(9,-1,-1))
plt.show()
I cannot get the image to span the whole graphics window
thanks
Ilan

Masking image on Shape [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a photo, and on it, I have drawn a circle with a shape.
I want to make it so that only the parts of the photo that are within this circle are visible, and what is outside the circle should not be visible. Therefore, I should be able to position the image with part of it in the circle and end up with an image that is the shape of the circle.
Layer -> New Clipping Mask
Place image above the shape and apply the above.