At present, I am working on core graphics based iPhone application.
I have tried to crop center of the image but i can't do that.
Here,I have an images named (fig a) as shown below, and i need to crop it on center of this image.
So, the resultant image should look like (fig b).
How can i do this?.
fig a :
fig b :
Answer :
I think what you want is : iOS UIImage clip to paths. Rob has described how to remove selected part of UIImage using UIBezierPath. You can customize it for yourself to get what you want.
You can also use some View as a Mask above that Central Part.
Take a look on BJIMageCropper
Hope This will helps you
Related
I've seen many solutions out here but they're not exactly what I'm looking for. What I'm attempting to do is have the view's background to move an image multiple times-- slowly and diagonally rather than horizontally or vertically.
From a web designing perspective, this can be achieved with a tiled bg.gif where the image gives the effect of an image moving without additional programming.
Example:
However, I'm not sure whether this is achievable within Swift programming. I'm sure alternative solutions are out there like having a single image (a smiley face) tiled to fill the view frame and have it move diagonally by incrementing it's x & y coordinates.
I'm new to iOS development and Swift yet I am learning a lot! Much help will be appreciated.
refer this two links. it will help to achieve what you want. click here and click here
Update as advised in comment : download SwiftGif and Import the Gif.swift in your project and do the following:
// Returns an animated UIImage
let myGif = UIImage.gifWithName("imggif")
// Use the UIImage in your UIImageView
let imageView = UIImageView(image: myGif)
here imggif is your gif image which shown in question. put it in your project
hope this will help :)
In my project, I want to set 4 cropping points manually on an image and crop that image according to set points. For example have a look on below image.
Like this, all I want is to crop the image according to that path and after cropping it should be a rectangle. This is just like image cropping in CamScanner IOS application. If anyone have any idea how to do this any help would be highly appreciated.
Here are found very nice github project that have same funtionality what you want but this is in Objective-C might be you can convert this code in to swift check the link following:
https://github.com/jberlana/JBCroppableView
It's output is:
UPDATE
I just made one Demo in Swift using JBCroppableView Objective-C class implements in Swift. Download from the following and use as per your requirement.
https://github.com/nitingohel/NGCropview
The Combination of Swift + Objective-C
OUTPUT
I think you need geometric_transformations.
If you plan to use opencv, here is a good example:
http://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/
I'm currently developing an iOS app that is using OCR.
Currently I'm using AVFoundation to preview the video from the camera (using Apples sample AVCam).
For a good user experience I want to lay out a rectangle in the preview layer. The image inside this rectangle will be the image parsed by the OCR engine. My problem is that I also would like to "dim" everything outside this rectangle and I'm currently out of ideas how to solve this. Does anybody know how to do this?
Edit
This is what I would like to accomplish (image taken from the app Horizon):
http://i.imgur.com/MuuJNS9.png
You can use two black images covering the top and bottom areas that you want to "dim", set the alpha of those images to a certain value, like 0.5.
Why not add a subview that covers the entire screen and set the background color to a semi transparent gray - your gray overlay?
And then add the image parsed by the OCR engine add a subview of this grayoverlay int the center of it
I have a viewController with a UIImageView. The imageView is to be loaded with a different random picture from a given array when the viewController is displayed. Above the UIImageView I would like to implement a filter similar to one I found in photoshop but with my own custom modification for a clear window to the image below. Basically, what I am looking to do is display a random image behind a blurred filter but I would like a part of the blur filter to have a custom shaped window to the image below it where the image can be seen clearly. The rest of the image would still be blurred out. I have read apples documentation for applying filters to images but none of them suit my needs. Pretty new to development and haven't written any code for this feature yet. I'm more looking to see if it can be done and if so, could you point me in the direction of where I can research to find the answers I'm looking for? cheers!
I would recommend that you take the input image, pass it through a CIGaussianBlur, then I'd draw the image applying an image mask (using CIBlendWithMask or a CGPath.)
I have this two images :
(source: free.fr)
(source: free.fr)
How can I use imagemagick to remove the background (second picture) from the first one ?
Cheers,
Rémy
Here I made you a final but simple example :
Transparent Overlay http://noosphere.ionyse.com/transparent_example/transparent_difference.png
Background http://noosphere.ionyse.com/transparent_example/background.png
Example 1 http://noosphere.ionyse.com/transparent_example/background-example.png
Example 2 http://noosphere.ionyse.com/transparent_example/background-example2.png
Here you see that anywhere I put the transparent overlay on the background I get the perfect match using the opacity of the overlay PNG.
I would like to be able to calculate this overlay image. Do you think it is possible using ImageMagick ?
This is explained over here How to save the DIFFERENCES between two images ?.
Another useful link: http://www.imagemagick.org/Usage/compare/#difference