crop

PHP fit any size image to 16:9 aspect ratio

本小妞迷上赌 提交于 2019-12-02 23:26:11
问题 Good noon, I'm currently trying to understand how i can crop image already loaded on server with 16:9 aspect ratio. For better understandig, if I have 4:3 image i have to cut top and bottom image portions to fit it into 16:9 ratio. Thanks. 回答1: I took this code example: http://myrusakov.ru/php-crop-image.html and changed the code according to my needs in this way: function crop_image($image) { //$x_o и $y_o - Output image top left angle coordinates on input image //$w_o и h_o - Width and

Problems with cropping a UIImage in Swift [duplicate]

你说的曾经没有我的故事 提交于 2019-12-02 23:21:29
This question already has answers here : How do I crop a UIImage in Swift? (2 answers) I'm writing an app that takes an image and crops out everything except for a rectangle in the center of the image. (SWIFT) I can't get the crop function to work though. This is what I have now: func cropImageToBars(image: UIImage) -> UIImage { let crop = CGRectMake(0, 200, image.size.width, 50) let cgImage = CGImageCreateWithImageInRect(image.CGImage, crop) let result: UIImage = UIImage(CGImage: cgImage!, scale: 0, orientation: image.imageOrientation) UIImageWriteToSavedPhotosAlbum(result, self, nil, nil)

Angular JS Image Crop Directive [closed]

只愿长相守 提交于 2019-12-02 23:03:35
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Can anyone recommend a decent image cropper directive for Angularjs? I've looked at a few out there and can't find much of anything. Has anyone found one they use that they like? We currently use angular-file-upload ( https://github.com/danialfarid/angular-file-upload ) to upload files so it would be nice if it worked with this. you could try ngImgCrop which it's awesome! it's way more than only a image cropper! and I

iOS - How to customize the crop rect in UIImagePickerController with allowsEditing on?

柔情痞子 提交于 2019-12-02 21:18:46
Is there any way to define the crop area rect using the camera image picker? Yetanotherjosh Unfortunately, no. You have to implement a custom cropping GUI to get anything other than the default, as stated in the Camera Programming Topics for iOS: "When using built-in editing controls, the image picker controller enforces certain options. For still images, the picker enforces a square cropping as well as a maximum pixel dimension. For movies, the picker enforces a maximum movie length and resolution. If you want to let the user edit full-size media, or specify custom cropping, you must provide

How to detect position of shape in image PHP [closed]

删除回忆录丶 提交于 2019-12-02 20:30:00
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have image with white background and in that image i have some kind of shape - part of cloth. I need to find most left, up, right and bottom pixel. What is the most efficient way to do that? 回答1: You can use the trimImage function to trim the image, and then look at the geometry

Android: Cropping an image to specific size

允我心安 提交于 2019-12-02 19:50:19
My intention is to have the user pick an image from the gallery, then have a cropping activity come up. However, I need the rectangle that defines the cropping mask to be locked to a certain dimension and then the user simply repositions it to display a portion of an image. Any ideas on how this would be done? Thanks -T Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null) .setType("image/*") .putExtra("crop", "true") .putExtra("aspectX", width) .putExtra("aspectY", height) .putExtra("outputX", width) .putExtra("outputY", height) .putExtra("scale", true) .putExtra("scaleUpIfNeeded", true

Crop an image in the centre using PIL

我的未来我决定 提交于 2019-12-02 19:09:51
How can I crop an image in the center? Because I know that the box is a 4-tuple defining the left, upper, right, and lower pixel coordinate but I don't know how to get these coordinates so it crops in the center. Chris Clarke Assuming you know the size you would like to crop to (new_width X new_height): import Image im = Image.open(<your image>) width, height = im.size # Get dimensions left = (width - new_width)/2 top = (height - new_height)/2 right = (width + new_width)/2 bottom = (height + new_height)/2 # Crop the center of the image im = im.crop((left, top, right, bottom)) This will break

crop and Save ROI as new image in OpenCV 2.4.2 using cv::Mat

拜拜、爱过 提交于 2019-12-02 18:53:57
Working on Face Detection and Recognition, and after successfully detecting a face, I just want to crop the face and save it somewhere in the drive to give it for the recognition code. I am having hard time doing the saving the Region of Interest as a new image. I have got some codes online but it is written in the previous version of OpenCV that uses IplImage* . I am using OpenCV 2.4.2 that uses cv::Mat . Heeeelp!!! I will post my codes(Face detection and Recognition per se) if you guys want it. #include <cv.h> #include <highgui.h> #include <math.h> // alphablend <imageA> <image B> <x> <y>

Zoom and Crop Image (Matrix)

无人久伴 提交于 2019-12-02 18:52:31
问题 I have 2 questions that pertains to zooming and cropping of an image. 1) Zooming into an image that would make the image twice as large in both height and width and that each pixel in the matrix is replicated to become 4 pixels. Was wondering if this can be accomplished without using any loops or interpolations and the function imresize. 2) Cropping a matrix by selecting a certain area of the image and then cropping it to a certain length and height. Again, I'm wondering how this can be

How to clip WorldMap with polygon in R?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 18:34:37
I have imported a world map dataset from www.GADM.org using the R package raster. I would like to clip it to a polygon I create to reduce the size of the map. I can retrieve the data and I can create the polygon no problem, but when I use the 'gIntersection' command I get an obscure error message. Any suggestions on how to clip my World Map dataset? library(raster) library(rgeos) ## Download Map of the World ## WorldMap <- getData('countries') ## Create the clipping polygon clip.extent <- as(extent(-20, 40, 30, 72), "SpatialPolygons") proj4string(clip.extent) <- CRS(proj4string(WorldMap)) ##