crop

Cropping images sometimes a wrong area

僤鯓⒐⒋嵵緔 提交于 2019-11-30 09:47:47
问题 I'm using jQuery-cropbox to crop images on a web application. Everything is running smoothly most of the time, but from time to time, the generated image is wrong, as if the cropping was applied with wrong coordinates. As an example, consider this image : In cropbox, I zoom and drag until I get this : But when I click on the crop button, it gives me this: Here is the cropping code: private Bitmap CropImage(Image img, Rectangle rect) { Bitmap newImg = new Bitmap(rect.Width, rect.Height);

iOS Determine the corners of a Business Card in realtime

血红的双手。 提交于 2019-11-30 09:32:10
I want to implement a business card detecting functionality like this app ( https://scanbot.io ). The camera should detect a business card and automatically take a picture of it (only the business card). My idea was using BradLarson's GPUImage library, detect the corners (using the Harris corner detection algorithm), calculate the biggest rectangle with the corners obtained and crop the image contained inside the rectangle. Here is my code: - (void)setupFilter { videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition

Crop an image using rectangular box of selected area?

ε祈祈猫儿з 提交于 2019-11-30 07:42:13
I am looking for a good tutorial or sample code, that would show how to crop an image taking from iphone camera something in lines of but you would control the corners with your fingers any tip would be greatly appericated, as i tried in many way but didn't get a result. Anil Kothari some changes in the button action -(IBAction) cropImage:(id) sender{ // Create rectangle that represents a cropped image // from the middle of the existing image float xCo,yCo; float width=bottomCornerPoint.x-topCornerPoint.x; float height=bottomCornerPoint.y-topCornerPoint.y; if(width<0) width=-width; if(height<0

Crop/trim a JPG file with empty space with Java

人盡茶涼 提交于 2019-11-30 07:12:09
问题 Is there a framework which is able to remove the white space (rectangular) of an image. We create Image Thumbnails from technical drawings which are unfortunately in PDF format. We convert the PDF to SVG and then to JPG. Often the technical drawings are very small and now placed in the upper left corner of the thumbnail: +---------+----------------------+ | | | | (image) | | | | | +---------+ | | | | | | | | | | (empty space) | | | | | +--------------------------------+ So how can I easily

Android Camera - How can i take a specific “rectangle” from the byte array?

て烟熏妆下的殇ゞ 提交于 2019-11-30 07:06:19
I have created an application that shoots and saves photos. I have a preview and an overlay on top of that preview. The overlay defines a square (the area around the square shows the preview a bit darker), as you can see in the image: example What i need to do is to extract the part of the image where the square is. The square is defined like this: Rect frame = new Rect(350,50,450,150); How can i do that? i have the byte array (byte[] data) that i can save, but i want to change the application so that only the square area will be saved. Edit: i have tried the following: int[] pixels = new int

Cropping Image in Android (Crop Intent)

ⅰ亾dé卋堺 提交于 2019-11-30 05:50:43
I used this code to use android's built in image crop tools. My code is the following public void takePicture(){ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null){ takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString()); takePictureIntent.putExtra("crop", "true"); takePictureIntent.putExtra("aspectX", 0); takePictureIntent.putExtra("aspectY", 0); takePictureIntent.putExtra("outputX", 200); takePictureIntent.putExtra("outputY", 150); takePictureIntent

Android, can't upload images using WebView

左心房为你撑大大i 提交于 2019-11-30 05:47:34
问题 I'm looking for a solution for some days for my problem but I can't find a good one. So I wanted to ask here again before I start developing a native app for Android since I can't solve this problem. As the title says, I'm trying to upload an image by using webview to a html content which NORMALLY is choosing an image, showing it on the page and allowing user to crop it. I made whole app and had tested it on normal browser of my phone so I didn't know that this woulnd't work. That's why it's

Best resize and or crop logic

拈花ヽ惹草 提交于 2019-11-30 05:14:24
问题 I've come across this a few times and thought it would be good to put it out there. What's your best image resize and/or crop logic. The idea being that some method is called with a target image, dimensions and a crop flag - this would return or save off or whatever the desired image. Mine is below. Converted from VB to C# so yes there'll be small bugs but logic is what we're looking at. // INIT // On/off bool WeAreCropping = true; // Get some dimensions int TargetWidth = RequestedWidth; int

how do i use imagick in php? (resize & crop)

别说谁变了你拦得住时间么 提交于 2019-11-30 02:06:31
I use imagick for thumbnail crop, but sometimes cropped thumbnails are missing top part of the images (hair, eyes). I was thinking to resize the image then crop it. Also, I need to keep the image size ratio. Below is the php script I use for crop: $im = new imagick( "img/20130815233205-8.jpg" ); $im->cropThumbnailImage( 80, 80 ); $im->writeImage( "thumb/th_80x80_test.jpg" ); echo '<img src="thumb/th_80x80_test.jpg">'; Thanks.. This task is not easy as the "important" part may not always be at the same place. Still, using something like this $im = new imagick("c:\\temp\\523764_169105429888246

How to select a portion of an image, crop, and save it using Swift?

人走茶凉 提交于 2019-11-30 01:57:42
I am trying to create an iOS app using Swift to capture images and let the user save a selected portion of the image. In many cam based apps, I noticed that a rectangular frame is offered to let the users choose the desired portion. This involves either sliding the edges of the rectangle or moving the corners to fit the required area. Could you please guide me on how to implement that moveable rectangle and how to save only that piece of the image? Using Swift 3 Image cropping can be done using CGImages from CoreGraphics . Get the CGImage version of a UIImage like this: // cgImage is an