crop

Set dimensions for UIImagePickerController “move and scale” cropbox

自作多情 提交于 2019-11-26 21:43:46
How does the "move and scale screen" determine dimensions for its cropbox? Basically I would like to set a fixed width and height for the "CropRect" and let the user move and scale his image to fit in to that box as desired. Does anyone know how to do this? (Or if it is even possible with the UIImagePickerController) Thanks! Not possible with UIImagePickerController unfortunately. The solution I recommend is to disable editing for the image picker and handle it yourself. For instance, I put the image in a scrollable, zoomable image view. On top of the image view is a fixed position "crop guide

Android crop background

折月煮酒 提交于 2019-11-26 20:48:34
问题 I have a LinearLayout with width set to fill_parent and height to wrap_content . Now I want to give it a background from a png file, but doing it in a traditional way causes the LinearLayout to resize in order to show the whole background instead of cropping the additional part. How can I set the background of LinearLayout so it won't resize? Thanks 回答1: It appears that such thing is achievable only using the ImageView and setting the scaleType parameter accordingly. A quick workaround is to

Resize/crop/pad a picture to a fixed size

旧巷老猫 提交于 2019-11-26 19:57:19
I need to resize a picture to a fixed size. But it has to keep the factors between the width and height. Say I want to resize a picture from 238 (w) X 182 (h) to 210 / 150 What I do now is: Original width / target width = 1.333333 Original Height / target Height = 1.213333 Now I take the smallest factor. Now I always have the right width since 238 / 1.333333 = 210 . But the height is still 160 . How do I get the height down to 160 without ruining the pic? Do I need to crop? If so how? This solution is basically the same as Can Berk Güder's, but after having spent some time writing and

Image Cropping API for iOS

你说的曾经没有我的故事 提交于 2019-11-26 19:43:40
问题 Is there any cropping image API for objective C that crops images dynamically in Xcode project? Please provide some tricks or techniques how could I crop camera images in iPhone. 回答1: You can use below simple code to crop an image. You have to pass the image and the CGRect which is the cropping area. Here, I crop image so that I get center part of original image and returned image is square. // Returns largest possible centered cropped image. - (UIImage *)centerCropImage:(UIImage *)image { //

How to Split Image Into Multiple Pieces in Python

萝らか妹 提交于 2019-11-26 19:19:35
问题 I'm trying to split a photo into multiple pieces using PIL. def crop(Path,input,height,width,i,k,x,y,page): im = Image.open(input) imgwidth = im.size[0] imgheight = im.size[1] for i in range(0,imgheight-height/2,height-2): print i for j in range(0,imgwidth-width/2,width-2): print j box = (j, i, j+width, i+height) a = im.crop(box) a.save(os.path.join(Path,"PNG","%s" % page,"IMG-%s.png" % k)) k +=1 but it doesn't seem to be working. It splits the photo but not in an exact way (you can try it).

iOS Custom UIImagePickerController Camera Crop to Square

為{幸葍}努か 提交于 2019-11-26 18:53:10
问题 I'm trying to create a camera like Instagram where the user can see a box and the image would crop to that box. For Some reason the camera doesn't go all the way to the bottom of the screen and cuts off near the end. I'm also wondering how would I go about cropping the image to be 320x320 exactly inside that square? 回答1: Here's the easiest way to do it (without reimplementing UIImagePickerController ). First, use an overlay to make the camera field look square. Here's an example for 3.5"

How to crop the parsed image in android?

萝らか妹 提交于 2019-11-26 18:46:36
I am parsing a website to display the contents in a URL, in that some images are there. I want to crop the images which are parsed from the site. I'm really struggling on this, can any one help me regarding on this? I assume you've already "got" the images down from the website and want to resize rather than crop? I.e. create thumbnails. If so, you can use the following: // load the origial BitMap (500 x 500 px) Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.android); int width = bitmapOrg.width(); int height = bitmapOrg.height(); int newWidth = 200; int newHeight =

Crop whitespace from image in PHP

你离开我真会死。 提交于 2019-11-26 18:37:51
Is it possible to remove the whitespace surrounding an image in PHP? NOTE: to clarify I mean something like photoshops trim feature. Thanks. To trim all whitespace, as you call it, surrounding the interesting part of the image, first we find out where the "whitespace" stops, and then we copy everything inside of those borders. //load the image $img = imagecreatefromjpeg("http://ecx.images-amazon.com/images/I/413XvF0yukL._SL500_AA280_.jpg"); //find the size of the borders $b_top = 0; $b_btm = 0; $b_lft = 0; $b_rt = 0; //top for(; $b_top < imagesy($img); ++$b_top) { for($x = 0; $x < imagesx($img

Crop an Image by passing the image file path in Android

[亡魂溺海] 提交于 2019-11-26 18:25:20
问题 I have tried the below code. However, it always results the 160*160 dimension image. try { //call the standard crop action intent (the user device may not support it) Intent cropIntent = new Intent("com.android.camera.action.CROP"); //indicate image type and Uri cropIntent.setDataAndType(Uri.fromFile(pictureFile), "image/*"); //set crop properties cropIntent.putExtra("crop", "true"); //indicate aspect of desired crop cropIntent.putExtra("aspectX", 100); cropIntent.putExtra("aspectY", 100);

PHP crop image to fix width and height without losing dimension ratio

爱⌒轻易说出口 提交于 2019-11-26 17:33:13
问题 im looking to create thumbnails that has 100px by 100px dimension. i've seen many articles explaining the methods but most end up having the width!=height if the dimension ratio is to be kept. for example, i have a 450px by 350px image. i would like to crop to 100px by 100px. if i were to keep the ratio, i would end up having 100px by 77px. this makes it ugly when im listing these images in a row and column. however, a image without dimension ratio will look terrible as well. i've seen images