How to draw an outline to an image in iPhone sdk - iphone

I want to draw an outline to an image. Is there any simple way to do that in iPhone sdk.

Besides drawing it urself on the screen you can maybe have an image of the outline and put 2 image views on top of each other to get the picture with it's outline

If you have limited number of images that you need to do this with, use a drawing program to create an outlined version of each image, then use setImage: on a UIImageView to display one or the other image.
If you need to draw an outline around sone arbitrary image at run time, that's a bit harder.

Use this Header file and also import QuartzCore.framework framework. Your job is done.
#import "QuartzCore/QuartzCore.h"
mImage.layer.borderWidth = 2;

Related

How to take UIView screenshot in which AVPlayer is playing?

I am trying to generate a video from the screenshots taken from a specific UIVIew. This view have an AVPlayer subview and also a canvas subview(in which we can draw shapes). Just tried the normal way of UIGraphicsGetImageFromCurrentImageContext and the screenshot was black. I think its because the video is rendered in GPU.
So I tried to take a screenshot of a GLKView to which the above two subviews were added. But still its giving the GLKView background colour as images. Referred the below two links for my purpose.
Tried adding glkview as in this post.
Taking screenshot from a GLKView
Am I going the right way? If yes, Please help me to understand what I am missing.
OR
Is there anyother better way to do this? AVAssetImageGenerater is not at all suitable for my requirement and so I cant use it too.
AVAssetImageGenerater is not at all suitable for my requirement and so
I cant use it too.
What is the reason for this i don't know but by using AVAssetImageGenerater it is possible to take snap of the video and draw the snap image over the screenshot image is easy as you know the frame of the black part.
See below post to put a UIImage over another UIImage.
Draw another image on a UIImage

iPhone app - load an UIImage and the put a small positional icon (image) on it?

I have looked everywhere for what should be a simple concept. I can load an image(s) with UIView/UIImageView and just want to place a smaller icon/image on top of the original image at a given position. Thanks in advance for your help.
Create another UIImageView with the second image and position it on top of the first one.

Show photo with SCRATCH OUT EFFECT by finger

I need your help to know how to create an iPhone application to show a photo with SCRATCH OUT EFFECT.
Something like the effect in this flash tutorial
http://www.tutorial5.com/content/view/115/46/
Please help.
Thanks.
You can have a look at the following post on how to create a blurred image effect, I don't think it's the best & fasted method, but it might get you started:
UIImage blur
You can implement the scratch out effect by using CoreGraphics.
Subclass UIView for the scratchable image.
Draw the scratchable image, use a mask to cut out the parts of the image that gets "scratched".
Each time the user scratches the image, make it so the mask and the image gets updated.
Full code example on github

Modifying, coloring and dragging pre-existing images iPhone application

I am developing an iphone application which would let me modify the image by dragging other images over its top along with functionality that would let me choose a specific color from the image and replace it with some other color shades i choose. If anyone has some clue like how to actually implement it or some code, that would be great help for me to proceed in right direction
Thanks in advance :)
If you just want to overlay images, you can simply drag UIImageViews around and position them within the view hierarchy such that the appropriate images are overlaid one on top of the other.
For generating a new image out of those composited images, you may want to use something like CGContextDrawImage() within a UIView subclass's -drawRect: method or in a custom CGContext. You can also refer to these similar questions:
How can we combine images and get image object from this two images in iphone apps
Combining images
As far as selectively replacing a specific color within a UIImage, that's a commonly asked question here:
In a UIImage (or its derivatives), how can I replace one color with another?
How to make one color transparent on a UIImage?

UIImageView scaling/interpolation

I have a small IPhone app that I am working on and I am displaying an image with a UIImageView. I am scaling it up using the Aspect Fit mode. I would like to have the image scale up with no interpolation/smoothing (I want it to look pixellated). Is there any way I can change this behavior?
A little more general question would be can I implement my own scaling algorithm, or are there other built in ones that I can select?
You would need to set the magnificationFilter property on the view's layer to the nearest neighbour filter:
[[view layer] setMagnificationFilter:kCAFilterNearest]
Make sure you include the line
#import <QuartzCore/CALayer.h>
At the top of the file containing the call to setMagnificationFilter or it won't compile.
Swift
imageView.layer.magnificationFilter = kCAFilterNearest
imageView.layer.shouldRasterize = true
There are two ways you could do this. You can either implement a rescaling algrorithm without interpolation. If this is to much work you could rescale the image in another application like gimp or photoshop. This would work unless you needed to change the size dynamically in your application.