crop

How to crop an FMX TBitmap

一世执手 提交于 2019-12-01 23:04:05
I receive a bitmap via TCameraComponent.SampleBufferReady event. Then I need to crop the received image so that I get a, for instance, recangular image. I calculate the necessary parameters in the following method: procedure TPersonalF.SampleBufferReady(Sender: TObject; const ATime: TMediaTime); var BMP: TBitmap; X, Y, W, H: Word; begin Try BMP := TBitmap.Create; CameraComponent.SampleBufferToBitmap(BMP, true); if BMP.Width >= BMP.Height then //landscape begin W:=BMP.Height; H:=W; Y:=0; X:=trunc((BMP.Width-BMP.Height)/2); end else //portrait begin W:=BMP.Width; H:=W; X:=0; Y:=trunc((BMP.Height

UIImagePickerController Cropping?

一曲冷凌霜 提交于 2019-12-01 18:51:10
问题 I have read that it is automatic but it doesn't appear to be happening in my case. Using UIImagePickerController with allowsEditing set to YES I get my editing view with the crop square overlay, but when i am finished with the image its not cropped as I expect. Should it be automatic at this stage? If not, what might be a good solution to crop the image in the matching area that the default view provides? Thanks. 回答1: You are probably using the wrong key for the info dictionary:

How to crop an image in vb.net?

五迷三道 提交于 2019-12-01 18:05:09
The image can be anything. It can be jpg, png, anything. Load it. Crop it. Say removing first 100 pixels from the left. Save to the same file adatapost Use Graphics.DrawImage Method (Image, RectangleF, RectangleF, GraphicsUnit) method. Dim fileName = "C:\file.jpg" Dim CropRect As New Rectangle(100, 0, 100, 100) Dim OriginalImage = Image.FromFile(fileName) Dim CropImage = New Bitmap(CropRect.Width, CropRect.Height) Using grp = Graphics.FromImage(CropImage) grp.DrawImage(OriginalImage, New Rectangle(0, 0, CropRect.Width, CropRect.Height), CropRect, GraphicsUnit.Pixel) OriginalImage.Dispose()

UIImagePickerController Cropping?

蓝咒 提交于 2019-12-01 17:43:38
I have read that it is automatic but it doesn't appear to be happening in my case. Using UIImagePickerController with allowsEditing set to YES I get my editing view with the crop square overlay, but when i am finished with the image its not cropped as I expect. Should it be automatic at this stage? If not, what might be a good solution to crop the image in the matching area that the default view provides? Thanks. You are probably using the wrong key for the info dictionary: UIImagePickerControllerOriginalImage . To get the cropped (yes, it is automatic) image you have to use

Crop image in CSS

橙三吉。 提交于 2019-12-01 16:18:20
I've created a two-column grid of images, which works fine with all-landscape images: Link . However, I've added a portrait image that throws off the layout, so I'd like to be able to "crop" the image so that the height matches the others'. I tried using a negative margin , but it had no effect: .portrait-crop { overflow: hidden; } img.portrait-crop { margin-bottom: -30px; } I'm not sure what I'm doing wrong. Any help would be appreciated. For reference, this is my code . You need to put some height to the container also, if not, it doesn't know how much it should show of what it is inside.

How to crop an image in vb.net?

五迷三道 提交于 2019-12-01 16:14:30
问题 The image can be anything. It can be jpg, png, anything. Load it. Crop it. Say removing first 100 pixels from the left. Save to the same file 回答1: Use Graphics.DrawImage Method (Image, RectangleF, RectangleF, GraphicsUnit) method. Dim fileName = "C:\file.jpg" Dim CropRect As New Rectangle(100, 0, 100, 100) Dim OriginalImage = Image.FromFile(fileName) Dim CropImage = New Bitmap(CropRect.Width, CropRect.Height) Using grp = Graphics.FromImage(CropImage) grp.DrawImage(OriginalImage, New Rectangle

I want to save only the cropped image into the gallery. but it saves the original full image. how to save only the cropped image?

帅比萌擦擦* 提交于 2019-12-01 14:11:10
public class ImageCroppMainActivity extends Activity implements OnClickListener{ final int CAMERA_CAPTURE = 1; //keep track of cropping intent final int PIC_CROP = 2; //captured picture uri private Uri picUri; final int PICK_IMAGE = 3; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_cropp_main); //retrieve a reference to the UI button Button captureBtn = (Button)findViewById(R.id.capture_btn); //handle button clicks captureBtn.setOnClickListener(this); Button

Crop a diagonal area from an image in WPF

≯℡__Kan透↙ 提交于 2019-12-01 13:45:58
I want to crop from an image using user-drawn rectangles on a canvas. The rectangles can be moved, re-sized, and rotated. When the user selects "Get Cropped Image", the area inside the rectangle should be saved in a second image location on the page, which I can do perfectly well, so long as the rectangle is not rotated. (Straight-forward use of CroppedBitmap.) However, when the rectangle is at an angle I do not know how to perform the crop. This is what I want to do (forgive my poor MS Paint skills): My questions are: 1) How do I correctly track or calculate the points of the rectangle? and,

Opencv c++ detect and crop white region on image

你离开我真会死。 提交于 2019-12-01 13:19:59
问题 I've searched the web nd I already found a few methods to do what I want, but these methods fail in efficiency compared to what I need. I have a kinect(using Microsoft SDK) which iscurrently acquiring a person removing the background, saving the result in a 3 channel Mat with the person removed from the background. Now I need crop the image to fit only that person, ignoring the black region. Here's the tricky part: I don't have many time to waste on every operation (I also need to do several

Find the edges of image and crop it in MATLAB

妖精的绣舞 提交于 2019-12-01 13:00:43
I have a RGB image. I have scanned the image. So the image occupies a small portion of an A4 size sheet. I want to find the border of the image and crop it. I could use edge detection operators like 'Sobel' etc, but they detect all the edges present in the image. All I want is the border of the image. Also many of the edge detection functions including 'bwboundaries' work only with binary or grayscale images. My image is RGB. I tried using 'imcrop', but this is more of interactive cropping. I am keen on doing this automatically. Uploading a test image: Since this is an rgb image, there will be