lucasecf / lecroppictureviewcontroller Goto Github PK
View Code? Open in Web Editor NEWA nice controller to crop round or rect images
License: MIT License
A nice controller to crop round or rect images
License: MIT License
Since this view controller is used to pick out a section of an image of any size, it would be useful to return the crop rect so that the caller can then cut out the rect (or circle) from the original image. Currently the view controller only cuts out the image in the scaled image, resulting in a potentially lower res image.
I would like to request a feature.
It would be good to have the option to have the crop square/circle fixed in the middle and have the user resize and move the image below to the location he wants.
I need a case where my image size should be 300x300, but users may want to put more inside the crop space then just having the image fullscreen.
Thanks!
If I use a UIImagePicker with .sourceType = .Camera, the resulting image in the LECropPictureViewController is incredibly thing and not scaled properly. Everything works totally fine with when the image is gathered from .sourceType = .PhotoLibrary. My didFinishPickingMediaWithInfo: method is below (in Swift):
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
println(info)
let originalImage = info[UIImagePickerControllerOriginalImage] as! UIImage
let cropController = LECropPictureViewController(image: originalImage, andCropPictureType: LECropPictureType.Rounded)
cropController.imageView.contentMode = UIViewContentMode.ScaleAspectFit
cropController.photoAcceptedBlock = { (croppedImage: UIImage!) -> Void in
let scaledImage = self.scaleImage(croppedImage, size: 300.0)
let thumbnailImage = self.scaleImage(croppedImage, size: 100.0)
self.profPic = scaledImage
self.thumbnail = thumbnailImage
self.refreshImageView(self.profPic!)
picker.dismissViewControllerAnimated(true, completion: nil)
}
picker.pushViewController(cropController, animated: true)
}
Are you going to launch a version in Swift 3?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.