crop

How to crop an image while uploading?

好久不见. 提交于 2019-12-05 22:31:19
I am doing an social networking project ,where i have an option to add/edit photos ,When user clicks the button the image will be uploaded to the database and it will be updated...is it possible to crop the image before it is saved to the database. simply call this function ..with param source ,destination and size what u want :) function cropImage($source,$dest,$whsize) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; $xratio=$w/$whsize; $yratio=$h/$whsize; if($xratio > $yratio)$multiplier=$xratio; else $multiplier=$yratio; $nw=$w/$multiplier; $nh=$h/$multiplier; switch($size[2]

What does the return value of SurfaceTexture.getTransformMatrix mean, who can explain?

允我心安 提交于 2019-12-05 20:58:38
Everyone, I am working with SurfaceTexture in Android but I am not able to understand Its API: getTransformMatrix(float[] mtx), the API doc is as follows: /** * Retrieve the 4x4 texture coordinate transform matrix associated with the texture image set by * the most recent call to updateTexImage. * * This transform matrix maps 2D homogeneous texture coordinates of the form (s, t, 0, 1) with s * and t in the inclusive range [0, 1] to the texture coordinate that should be used to sample * that location from the texture. Sampling the texture outside of the range of this transform * is undefined. *

C# images cropping,splitting,saving

空扰寡人 提交于 2019-12-05 19:34:22
as stated in subject, i have an image: private Image testing; testing = new Bitmap(@"sampleimg.jpg"); I would like to split it into 3 x 3 matrix meaning 9 images in total and save it.Any tips or tricks to do this simple? I'm using visual studios 2008 and working on smart devices. Tried some ways but i can't get it. This is what i tried: int x = 0; int y = 0; int width = 3; int height = 3; int count = testing.Width / width; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); for (int i = 0; i < count; i++) { g.Clear(Color.Transparent); g.DrawImage(testing, new

PHP - Mask polygon over image

馋奶兔 提交于 2019-12-05 18:53:32
Hi Everyone (this is my first post), I am trying to figure a way of cropping a polygon out of an image. I have been reading other similar code. It seems that most code is based around the following process: Resize the image to fit the width and height of the polygon shape, Create a blank image of an unusual colour the same size, Overlay transparent pixels in the shape of the polygon, Overlay that on to the resized image Set the unusual colour to be transparent... My problem is I do not want the code to be reliant on the unusual colour not being in the original image. Does anyone have a better

Crop image to a square according to the size of a UIView/CGRect

不打扰是莪最后的温柔 提交于 2019-12-05 18:18:08
问题 I have an implementation of AVCaptureSession and my goal is for the user to take a photo and only save the part of the image within the red square border, as shown below: AVCaptureSession's previewLayer (the camera) spans from (0,0) (top left) to the bottom of my camera controls bar (the bar just above the view that contains the shutter). My navigation bar and controls bar are semi-transparent, so the camera can show through. I'm using [captureSession setSessionPreset

Crop Image from camera before upload (Phonegap)

旧时模样 提交于 2019-12-05 17:30:01
i would like to ask you.. i have a code... using phonegap.. but i was confused about how to call / crop the image after take it from camera / file manager... here the code... <!DOCTYPE HTML> <html> <head> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="js/jquery.mobile-1.0.min.css" /> <script src="js/jquery-1.6.4.min.js"></script> <script src="js/jquery.mobile-1.0.min.js"></script> <script type="text/javascript" charset="utf-8" src="phonegap-1.1.0.js"><

Opencv Python Crop Image Using Numpy Array

谁说胖子不能爱 提交于 2019-12-05 14:12:45
I am using OpenCV 3.1.0-dev and python 2.7. I am trying to crop out the black exterior of an image I have stitched. The struggle is that there are other pixels in the image that are black so cv2.findcontours returns a very interesting numpy array. The first image is what I have and the 2nd image is the target. I was wondering if someone knew how to crop a polygon into the smallest square containing the entire image. The blue lines and points are the contours found by cv2.findContours. Is it possibly to find the top-left most point in the numpy array and the bottom-right most p0int in a numpy

Crop pictures with Leptonica API -> OR which image processing Lib to use?

徘徊边缘 提交于 2019-12-05 14:02:57
I'm trying to do two things -> First I need to read in an image and crop it ( coordinates / frame will be provided by the user ). Then I want to run an OCR over it. ( Actually the cropping an the OCR shall be strictly divided ). Now to my problem: For the OCR I'm using Tesseract, which is using the Leptonica API for the image processing. Since I'm programing for an embedded device I want to keep the count of different libraries low. So my best interest is to crop my image with Leptonica, so I don't need a third library just to do this task. So my question is now, how can I cut out frames with

Crop Drawable to Square

╄→гoц情女王★ 提交于 2019-12-05 13:07:55
I have a drawable that I have resized to the appropriate desired height (25dp), and the width is scaled proportionally. However, I want an image that is square, with a width of 25dp as well. However, I do not want to distort the image, so I am looking to to crop equal portions of the right and left of the drawable to give me the center 25dpx25dp. Is this possible? How? I have been trying for the past two hours and I'm about ready to throw in the towel... Bitmap target= Bitmap.createBitmap(width, height,Config.ARGB_8888); Canvas canvas = new Canvas(target) float hScale = width/(float)source

Resizing and cropping image with GD while retaining aspect ratio

与世无争的帅哥 提交于 2019-12-05 11:43:53
I'm currently coding an uploader script based on Uploadify. Right now I resize the given image and watermark one of the sizes. It all works well, but I need the script to resize the height and then crop the width so that the aspect ratio does not get messed up. This is my code so far: if ($fileExtension == "jpg" || $fileExtension == "jpeg" || $fileExtension == "png" || $fileExtension == "gif"){ // GD variables: list($width, $height, $type) = GetImageSize($uploadedFile['tmp_name']); // Image sizes: $bigImage = array(800, 453); $mediumImage = array(410, 231); $listImage = array(120, 68);