crop

WPF - using CroppedBitmap in DataTemplate

筅森魡賤 提交于 2019-12-02 03:30:54
问题 The following xaml works ok inside a Window : <Border Width="45" Height="55" CornerRadius="10" > <Border.Background> <ImageBrush> <ImageBrush.ImageSource> <CroppedBitmap Source="profile.jpg" SourceRect="0 0 45 55"/> </ImageBrush.ImageSource> </ImageBrush> </Border.Background> </Border> But when I use the equivalent code in a DataTemplate I get the following error in run-time: Failed object initialization (ISupportInitialize.EndInit). 'Source' property is not set. Error at object 'System

Nodejs image crop by coordinates

☆樱花仙子☆ 提交于 2019-12-02 03:28:13
Is there is way where we can give x, y coordinates while cropoing image. Currently what i am using is Imagemagick im.crop({ srcPath: upload_path+media_file_name, dstPath: upload_path+"thumb_"+media_file_name, width: 350, height: 210, quality: 1, gravity: 'Center' }, function(err, stdout, stderr){ }; This code is working but i haven't got luck with x , y coordinates. The following input i want to use for image cropping height:360 width:360 x:180 y:300 I don't speak node, but can you use the raw interface? It'll look something like im.convert(['inputimage.jpg','-crop','350x200+x+y','output.jpg']

Crop image using a fixed-size draggable picturebox

≯℡__Kan透↙ 提交于 2019-12-02 03:13:48
I'm working on a winforms project that involves cropping an image. My goal is to do this by using a fixed-size draggable picturebox control, allowing the user to select the area they want to preserve. My problem is when I crop the image; it "works" , but the crop area offsets a little. Here's the result I get: To clarify, I'm not talking about the zooming, that's per design. Notice the orange box is mostly focusing on the eye of the storm, but the cropped image is not. This is my code for the crop operation: private void tsbRecortar_Click(object sender, EventArgs e) { Rectangle recorte = new

How to save graphics created on a PictureBox?

你离开我真会死。 提交于 2019-12-02 03:04:12
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.CreateGraphics(); g.DrawImage(sourceBitmap, new Rectangle(0, 0, pictureBox3.Width, pictureBox3.Height),

WPF - using CroppedBitmap in DataTemplate

二次信任 提交于 2019-12-02 01:40:22
The following xaml works ok inside a Window : <Border Width="45" Height="55" CornerRadius="10" > <Border.Background> <ImageBrush> <ImageBrush.ImageSource> <CroppedBitmap Source="profile.jpg" SourceRect="0 0 45 55"/> </ImageBrush.ImageSource> </ImageBrush> </Border.Background> </Border> But when I use the equivalent code in a DataTemplate I get the following error in run-time: Failed object initialization (ISupportInitialize.EndInit). 'Source' property is not set. Error at object 'System.Windows.Media.Imaging.CroppedBitmap' in markup file. Inner Exception: {"'Source' property is not set."} The

Flash image upload with mandatory crop?

我怕爱的太早我们不能终老 提交于 2019-12-02 01:23:24
Anyone know of a Flash file (image) uploader that will force a user to resize and/or crop their image BEFORE uploading it? To then upload it as well. Basically, I don't want my server processing the image resize/crop. I want to specify a target aspect ratio and have the user resize and crop their image to make it fit. I've seen cropping uploaders before but they all seem to be server side. I saw a Flex one but I'm not sure it's "mandatory" -- Basically if the user just uploads the image without making edits, then I'd like the Flash to scale and fit the image into set dimensions...Leaving it I

Crop function BitBlt(…)

▼魔方 西西 提交于 2019-12-02 01:22:07
I want to create a crop function in an existing engine. This is what I already have: bool Bitmap::Crop(RECT cropArea) { BITMAP bm; GetObject(m_Handle, sizeof(bm), &bm); HDC hSrc = CreateCompatibleDC(NULL); SelectObject(hSrc, m_Handle); HDC hNew = CreateCompatibleDC(NULL); HBITMAP hBmp = CreateCompatibleBitmap(hNew, bm.bmWidth, bm.bmHeight); HBITMAP hOld = (HBITMAP)SelectObject(hNew, hBmp); BitBlt(hNew, 0, 0, bm.bmWidth, bm.bmHeight, hSrc, 0, 0, SRCCOPY); SelectObject(hNew, hOld); DeleteDC(hSrc); DeleteDC(hNew); DeleteObject(m_Handle); m_Handle = hBmp; } I want it to just copy the whole image

Android video crop using ffmpeg

廉价感情. 提交于 2019-12-02 01:11:03
I am using https://github.com/WritingMinds/ffmpeg-android-java for cropping a video using this command : execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out); where "in" is inputfile and "out" is outputfile. I went through a lot of same questions and couldn't find required solution for this. I also tried the following command which i found going through the search: execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out); The main error that I'm getting here is :

How does Instagram crop video in android app?

≯℡__Kan透↙ 提交于 2019-12-02 00:46:28
I am trying to record the video in 1:1 ratio (square) and i cant get it to work, if i set custom resolution in media recorder instance i get an error on media recorder start. mediaRecorder.setVideoSize(480, 480); but it works if i set the resolution supported by camera. Camera.Parameters p = c.getParameters(); List<Camera.Size> list = p.getSupportedPreviewSizes(); //They are ordered from largest to smallest, so the largest will be... for (Camera.Size i : list) { if (i.width <= 640 && i.width >= 480) { size = i; } Log.d(TAG, "i.height: " + i.height + " i.width" + i.width); } if (size != null) {

Camera2 preview stretched when cropping with SCALER_CROP_REGION

[亡魂溺海] 提交于 2019-12-02 00:09:47
I want to display a preview in fullscreen using camera2 api. The camera size I selected is 4160x3120 (16:9) and my screen is 1080x1920 (9:16). Therefore if I want the preview to be right scaled I have to crop the camera output : Rect zoomCrop = new Rect(0, 0, 1755, 3120); captureRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCrop); The cropped preview should be of size 1755x3120 which has a ratio of 9:16 as well. Still the preview is streched. Question : Am I using SCALER_CROP_REGION correctly ? If not, how am I supposed to use it ? Thanks in advance I've been struggling with the