crop

Using “com.android.camera.action.CROP” Intent to crop images, returns small size bitmaps on some devices

大城市里の小女人 提交于 2019-12-06 15:55:46
I am using "com.android.camera.action.CROP" to crop images from user`s image gallery.. Crop function: private void performCrop(String picUri) { try { Intent cropIntent = new Intent("com.android.camera.action.CROP"); File f = new File(picUri); Uri contentUri = Uri.fromFile(f); cropIntent.setDataAndType(contentUri, "image/*"); cropIntent.putExtra("crop", "false"); cropIntent.putExtra("aspectX", 1); cropIntent.putExtra("aspectY", 1); cropIntent.putExtra("outputX", 1024); //512 cropIntent.putExtra("outputY", 1024); //512 cropIntent.putExtra("return-data", true); startActivityForResult(cropIntent,

Implement a Take Picture + Crop or use premade Intents?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 14:09:48
问题 I'm in the middle of an Android app which takes a picture, crops it and does some extra stuff. I was hoping to do my own cropping system , but the problem comes when I test in different places. Pictures appear rotated in some cases, and not correctly cropped in others (like they had an extra margin around (seeing extra space of the original picture), or so). More on that, I've considered using Intents . This would release me from the picture taking madness, the cropping, and would add an

Are there any good examples of how to take a screenshot in selenium webdriver C#, then crop and save the image?

和自甴很熟 提交于 2019-12-06 14:09:32
问题 I've been searching for some good examples of how to take a screenshot using ITakesScreenshot in Selenium Webdriver in C#, then to crop the image using the elements dimensions and then saving this new image. With no such luck have I found any in C#. I have this method at the moment but every so often I get a Out of Memory exception when used in a test. It fails on the line where it tries to crop. public void TakeScreenShotOfElement(IWebDriver _driver, string rootpath, string imgName, string

Crop centered image inside div

时间秒杀一切 提交于 2019-12-06 13:18:38
I have a div containing an image (img) element, which extends for 100% width inside it. I would like to specify a maximum height for the div, and hide the parts of the image exceeding this height. But I also want to keep this image centered vertically inside the div to show only its central part. For example, if browser width is 1200px and image aspect ratio is 4:3, image should display (1200x900)px. But if we want to crop height to 300px only and center vertically, image should position at -300px inside the div (and the div should hide 0-300 and 600-900 of the image height). Similar thoughts

How to crop a 4*3 image in photoLibrary or camera in swift

耗尽温柔 提交于 2019-12-06 12:44:40
I want to crop the image after using camera or select from photoLibrary. For now, I can only crop the square image and I have no idea how to crop a 4*3 image. Here is my part of code let imagePicker : UIImagePickerController = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .PhotoLibrary imagePicker.allowsEditing = true I did not know that links are not permitted as answer. Here I will try to answer the question. Aim: Crop image with a predefined ratio. Approach: In the viewcontroller - we need to add a scrollview - so that we can put the image there and zoom or

iText - crop out a part of pdf file

不想你离开。 提交于 2019-12-06 11:11:02
I have a small problem and I'm trying for some time to find out a solution. Long story short I have to remove the top part of each page from a pdf with itext. I managed to do this with CROPBOX , but the problem is that this will make the pages smaller by removing the top part. Can someone help me to implement this so the page size remains the same. My idea would be to override the top page with a white rectangle, but after many tries I didn't manage to do this. This is the current code I'm using to crop the page. PdfRectangle rect = new PdfRectangle(55, 0, 1000, 1000); PdfDictionary pageDict;

iOS 11.1 UIImagePickerController video crop start time not movable

不羁岁月 提交于 2019-12-06 09:30:37
问题 We are displaying a UIImagePickerController for users to choose (and crop) a video for use within our app. Recently users have been experiencing issues trying to crop videos, with the start time handle becoming almost impossible to drag. It seems that the Photos app doesn't have this issue because the video timeline (and crop selection) is moved to the bottom of the screen. I assume this has to do with the new notification centre gestures that were added for the iPhone X. I believe this

ImageAreaSelect: preselect biggest thumbnail possible respecting aspectRatio

非 Y 不嫁゛ 提交于 2019-12-06 08:56:23
This is how I first tried: $('#thumbnail').imgAreaSelect({ x1: 5, y1: 5, x2: $('#thumbnail').width(), y2: $('#thumbnail').width()*0.66, aspectRatio: '1:0.66' }); But some of the cropped image stay off the overflow... This seems to make a preselection for most of the image resolutions I tried... var thwidth = $('#thumbnail').width(); var thheight = $('#thumbnail').height(); aspectRatio = 0.66; $('#thumbnail').imgAreaSelect({ x1: 5, y1: 5, x2: thwidth - 80, y2: (thwidth - 80) * aspectRatio, aspectRatio: '1:0.66' }); But it won't select the maximum possible; plus it looks a bit dirty to me... How

angularJS make binary data image from base64 and send as image file to server

a 夏天 提交于 2019-12-06 08:08:19
I'm using this tool to crop images in my AngularJS app: https://github.com/fengyuanchen/cropper and then I try to store data to server, but now I send base64 code... How could I send normal cropped image binary code, not as base64? is it real? my code for uploading is such: var addImage = function(files) { var deferred = $q.defer(); var fd = new FormData(); var blob = new Blob([files], { type : "image/png"}); fd.append("file", blob); $http.post(settings.apiBaseUri + "/files", fd, { withCredentials: true, headers: { 'Content-Type': undefined }, transformRequest: angular.identity }) .success

Always Null returned after cropping a photo from a Uri in Android Lollipop?

☆樱花仙子☆ 提交于 2019-12-06 06:11:14
问题 I tried to crop an image from a Uri after taking a photo or picking a picture. And my codes are like these: public static void cropImage(Uri uri, Activity activity, int action_code) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 600); intent.putExtra("outputY", 600); intent.putExtra("scale", true); intent.putExtra(