crop

Android Bitmap save without transparent area

假如想象 提交于 2019-12-31 21:33:56
问题 I want to save bitmap without transparent area. Bitmap has large transparent pixel. So i want to remove that How can i do this? I cant add picture so explain with symbols. I dont want to crop function. I hope use filter ┌────────────────────────┐ │ transparent area │ ┌────────┐ │ crop this └────────┘ └────────────────────────┘ 回答1: To find the non-transparent area of your bitmap, iterate across the bitmap in x and y and find the min and max of the non-transparent region. Then crop the bitmap

iOS - How to customize the crop rect in UIImagePickerController with allowsEditing on?

烂漫一生 提交于 2019-12-31 10:30:14
问题 Is there any way to define the crop area rect using the camera image picker? 回答1: Unfortunately, no. You have to implement a custom cropping GUI to get anything other than the default, as stated in the Camera Programming Topics for iOS: "When using built-in editing controls, the image picker controller enforces certain options. For still images, the picker enforces a square cropping as well as a maximum pixel dimension. For movies, the picker enforces a maximum movie length and resolution. If

How to clip WorldMap with polygon in R?

独自空忆成欢 提交于 2019-12-31 09:05:12
问题 I have imported a world map dataset from www.GADM.org using the R package raster. I would like to clip it to a polygon I create to reduce the size of the map. I can retrieve the data and I can create the polygon no problem, but when I use the 'gIntersection' command I get an obscure error message. Any suggestions on how to clip my World Map dataset? library(raster) library(rgeos) ## Download Map of the World ## WorldMap <- getData('countries') ## Create the clipping polygon clip.extent <- as

iPhone programmatically crop a square image to appear as circle

回眸只為那壹抹淺笑 提交于 2019-12-31 08:39:22
问题 I'm trying to create an image for a custom style UIButton using an image from the camera roll on iPhone. The button has a circular background and effectively appears as a circle. Now I need an image to go in the middle of the button that also appears round. How do I cut a square UIImage to appear round with transparency outside of the round area? If masking is involved, do I need to pre-render a mask or can I create one programmatically(ex: a circle)? Thank you! 回答1: Yes you can use

How to save graphics created on a PictureBox?

落花浮王杯 提交于 2019-12-31 04:30:54
问题 In c# and Visual Studio Windows forms I have loaded an image into a picture box (pictureBox2) and then cropped it and show in another picture box (pictureBox3). Now I want to save what is inside pictureBox3 as an image file. How can I do this? private void crop_bttn_Click(object sender, EventArgs e) { Image crop = GetCopyImage("grayScale.jpg"); pictureBox2.Image = crop; Bitmap sourceBitmap = new Bitmap(pictureBox2.Image, pictureBox2.Width, pictureBox2.Height); Graphics g = pictureBox3

PHP - cropping image with imagecopyresampled()?

ε祈祈猫儿з 提交于 2019-12-30 08:41:47
问题 I'd like to crop an image using imagecreatetruecolor and it always crops it leaving black spaces, or the zoom is too big. I want the image to be exactly 191px wide and 90px high, so I also need to resize the image, as well as crop, because the ratio has to be kept. Well, there are some samples of the project: The resize script (simplified) goes like this: $src_img=imagecreatefromjpeg($photoTemp); list($width,$height)=getimagesize($photoTemp); $dst_img=imagecreatetruecolor(191, 90);

PHP - cropping image with imagecopyresampled()?

折月煮酒 提交于 2019-12-30 08:41:05
问题 I'd like to crop an image using imagecreatetruecolor and it always crops it leaving black spaces, or the zoom is too big. I want the image to be exactly 191px wide and 90px high, so I also need to resize the image, as well as crop, because the ratio has to be kept. Well, there are some samples of the project: The resize script (simplified) goes like this: $src_img=imagecreatefromjpeg($photoTemp); list($width,$height)=getimagesize($photoTemp); $dst_img=imagecreatetruecolor(191, 90);

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

允我心安 提交于 2019-12-29 21:07:48
问题 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? 回答1: Using Swift 3 Image cropping can be

Swift: Crop and Export Video

让人想犯罪 __ 提交于 2019-12-29 06:16:29
问题 I want to crop a video to square, but i couldn't do that. I converted this code to swift but i only get black screen after exporting the video var videoComposition: AVMutableVideoComposition = AVMutableVideoComposition() videoComposition.frameDuration = CMTimeMake(1, 60) videoComposition.renderSize = CGSizeMake(clipVideoTrack.naturalSize.height, clipVideoTrack.naturalSize.height) var instruction: AVMutableVideoCompositionInstruction = AVMutableVideoCompositionInstruction() instruction

Cropping Concave polygon from Image using Opencv python

别说谁变了你拦得住时间么 提交于 2019-12-29 03:42:07
问题 How can I crop a concave polygon from an image. My Input image look like . and the coordinates of closed polygon are [10,150],[150,100],[300,150],[350,100],[310,20],[35,10]. I want region bounded by concave polygon to be cropped using opencv. I searched for other similar questions but I did not able to find correct answer. That's why I am asking it ? Can you help me. Any help would be highly appreciated.!!! 回答1: Steps find region using the poly points create mask using the poly points do mask