crop

Java image library to deskew and crop images

↘锁芯ラ 提交于 2019-11-28 01:49:28
问题 Does anybody have a suggestion for a java library that performs automatic cropping and deskewing of images (like those retrieved from a flatbed scanner)? 回答1: ImageMagick can do that; you can use the ImageMagick Java bindings. The auto-crop operator is probably what you're looking for. Automatic deskewing is a much harder problem and involves some significant image processing; I'm not sure if ImageMagick can handle that. If you can figure out the skewing parameters using something else,

How to crop a cross rectangle from an image using c#?

这一生的挚爱 提交于 2019-11-28 01:32:51
问题 I want to get some specific parts of an image so I'm cropping the images. However, when I want to get a part that is not parallel to the image, I rotate the image and crop afterwards. I don't want to rotate the image and crop a parallel rectangle. What I want is, without rotating the image, to crop a rectangle with an angle from the image. Is there any way to do that? I think I couldnt express myself well enough. This is what I want to do: example picture. Assume the red thing is a rectangle

How to trim the video file and convert to 20 seconds video with Swift?

会有一股神秘感。 提交于 2019-11-28 01:10:42
问题 I want to trim a video file. I want to just pick the video from gallery and convert it to a 15 second video. I am following this link for Objective C. It works fine for me but I'm a beginner with the Swift language. Can any one help me to convert this code in Swift? Below is my code in Objective C: -(void)cropVideo:(NSURL*)videoToTrimURL{ AVURLAsset *asset = [AVURLAsset URLAssetWithURL:videoToTrimURL options:nil]; AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]

Let user crop image

ぃ、小莉子 提交于 2019-11-27 20:53:45
I am having a hard time in figuring out how to let the user crop the picture. I would like to give bitmap variable with loaded bitmap to crop the picture before setting it as wallpaper. But I'm failing to do so... Here is that i tried. First version. = Works as expected BUT the returned image is in poor resolution. Changing the output to higher value doesn't help. As I saw in some post it is not recommended to use camera as not all devices support this. Intent intent = new Intent("com.android.camera.action.CROP"); String path = Images.Media.insertImage(context.getContentResolver(), loaded,null

Image Cropping API for iOS

匆匆过客 提交于 2019-11-27 19:03:35
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. 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 { // Use smallest side length as crop square length CGFloat squareLength = MIN(image.size.width, image.size

Automatically cropping an image with python/PIL

痞子三分冷 提交于 2019-11-27 18:51:47
Can anyone help me figure out what's happening in my image auto-cropping script? I have a png image with a large transparent area/space. I would like to be able to automatically crop that space out and leave the essentials. Original image has a squared canvas, optimally it would be rectangular, encapsulating just the molecule. here's the original image: Doing some googling i came across PIL/python code that was reported to work, however in my hands, running the code below over-crops the image. import Image import sys image=Image.open('L_2d.png') image.load() imageSize = image.size imageBox =

How to Split Image Into Multiple Pieces in Python

China☆狼群 提交于 2019-11-27 18:37:39
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). ElTero from PIL import Image def crop(path, input, height, width, k, page, area): im = Image.open(input

How can I crop an image with Pygame?

为君一笑 提交于 2019-11-27 17:47:30
问题 I am learning pygame and want a graphic for a button with the three states: normal, hover, and pressed. I have an image like this one ... ... and I want to get a new Surface using a portion of it. I'm loading the image with this code: buttonStates = pygame.image.load(os.path.join('image','button.png')) How can I make a new surface using just a portion of that graphic? 回答1: cropped = pygame.Surface((80, 80)) cropped.blit(buttonStates, (0, 0), (30, 30, 80, 80)) The blit method on a surface

iOS Custom UIImagePickerController Camera Crop to Square

给你一囗甜甜゛ 提交于 2019-11-27 17:08:31
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? 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" screens (you'd need to update it to work for iPhone 5): UIImagePickerController *imagePickerController = [

How to auto crop an image?

大城市里の小女人 提交于 2019-11-27 16:16:42
I am trying to make a scanning application. That application will scan the document and will display image in a picture box. The problem I am facing is image (Documents image which kept in the scanner or say ‘real ’image) is displaying inside another image with some background (That background color is also changing) its look like this image. I have tried lot of things but nothing giving me a perfect result I tried it with a forge.net. Here is the code I have tried. public static System.Drawing.Image AforgeAutoCrop(Bitmap selectedImage) { Bitmap autoCropImage = null; try { autoCropImage =