crop

FFMPEG command to crop and transpose video comes out zoomed in bad quality

我与影子孤独终老i 提交于 2020-01-03 13:10:40
问题 I'm trying to convert an mp4 video with dimensions usually 960x720 into a sqaure 480:480 video but it comes out looking squished usually, the command is "-y -i %s -vf crop=480:480,transpose=%d -threads 5 -metadata:s:v rotate=0 -c:v libx264 -crf 27 -preset ultrafast -c:a copy -bsf:a aac_adtstoasc %s"; Am I missing something, do I need to down scale first or something? **EDIT adding full console output. The ffmpeg command is updated, but the goal still remains the same, take an arbitrary video

wpf CroppedBitmap crop image as pixel values in double

随声附和 提交于 2020-01-03 05:10:09
问题 I am Cropping the image using CroppedBitmap method in WPF. Required input parameter is int32Rect. But, my image Height and Width values are in double (pixel). So without truncate the Double to Int, i want to crop the image by using double values (pixel) 回答1: You need to use PixelWidth and PixelHeight properties, if you can't see them ( Intellisense can't find them) you can use the as operator to cast it to a BitmapSource . For example: BitmapSource src = yourImage as BitmapSource;

Using buddypress avatar upload and crop function on another bp page

三世轮回 提交于 2020-01-03 03:13:11
问题 Currently I am using BP Avatar to create user profile picture in the website. Now, I want to use the upload and crop + preview function of BP Avatar for another page and another image purpose with custom settings also. I have tried to copy and edit the code in the new page but it can't work, even the preview. Hope someone can help. Thankyou. 回答1: Here is the code. I detect the problems start when bbp not detect the user because in the bbp core they get the user id from url, and in my case

How to crop a 4*3 image in photoLibrary or camera in swift

Deadly 提交于 2020-01-02 09:57:11
问题 I want to crop the image after using camera or select from photoLibrary. For now, I can only crop the square image and I have no idea how to crop a 4*3 image. Here is my part of code let imagePicker : UIImagePickerController = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .PhotoLibrary imagePicker.allowsEditing = true 回答1: I did not know that links are not permitted as answer. Here I will try to answer the question. Aim: Crop image with a predefined ratio.

What is a good algorithm or library for cropping images to avoid whitespace or empty areas?

喜欢而已 提交于 2020-01-02 04:56:07
问题 I have a whole bunch of images of illustrations that I would like to crop to a smaller preview size. The problem is that I want to crop them to show an "interesting" part of the illustration (ie avoid areas of whitespace). The images typically have a flat color or a subtle gradient for the background. They are mostly vector style artwork with fairly distinct shapes. Here are some examples: link ;-) I've been thinking about using some sort of image feature detection algorithm with a sliding

Resizing and cropping image with GD while retaining aspect ratio

懵懂的女人 提交于 2020-01-02 04:30:27
问题 I'm currently coding an uploader script based on Uploadify. Right now I resize the given image and watermark one of the sizes. It all works well, but I need the script to resize the height and then crop the width so that the aspect ratio does not get messed up. This is my code so far: if ($fileExtension == "jpg" || $fileExtension == "jpeg" || $fileExtension == "png" || $fileExtension == "gif"){ // GD variables: list($width, $height, $type) = GetImageSize($uploadedFile['tmp_name']); // Image

Change size of rectangle by dragging its corners in Android?

拟墨画扇 提交于 2020-01-01 15:29:25
问题 http://farm3.anhso.net/upload/20110221/12/o/anhso-121531_example.jpg Here is the examples, when you drag A or B , the size of rectangle will be changed How can i do it? 回答1: Its fairly simple. Let me assume that there is only a single view in your layout. This makes a few things a lot easier. When you receive a touch down action, you must check where on the view this point lies. the coordinates of the rectangle are obviously known to you. Also understand that you need to touch in the vicinity

Cropping a UIImage according to the viewport inside a UIScrollView

安稳与你 提交于 2020-01-01 07:00:05
问题 I have a UIImageView (initialized with Aspect Fill) inside a UIScrollView. The user shall use that to resize and position a UIImage to his like, press a button and then exactly what he sees on screen would be sent to a server, only in the original image coordinates. In other words, the resulting image would be bigger than the image on screen. Here's the essential part of my code so far: // select the original CGFloat imageRatio = self.imageView.image.size.width / self.imageView.image.size

How to crop PDF margins using pdftk and /MediaBox

自闭症网瘾萝莉.ら 提交于 2020-01-01 05:16:21
问题 I used pdftk to uncompress a PDF and then opened it as a text file. I want to edit the /MediaBox field, which is in my case /MediaBox [0 0 612 792] I would like to reduce the margins, for instance /MediaBox [100 0 512 792] Unfortunately it doesn't work. I can change the 0 into a 2 or a 9 but I cannot put 100 for instance. Any idea why? 回答1: use sed to replace any occurrence sed 's/MediaBox \[0 0 612 792*/MediaBox \[100 0 512 792]/g'<in.pdf >out.pdf or podofobox (inside podofo utils ) http:/

Full Bleed Image Resize Calculation

◇◆丶佛笑我妖孽 提交于 2020-01-01 00:21:15
问题 Hey Guys, I'm trying to write a JavaScript function that will expand an image to fill a div always (so crop top or sides as needed). It's the JavaScript equivalent of the CSS3 code background-size: cover. I can't for the life of me figure it out. This is what I have so far: function full_bleed(box_width, box_height, new_width, new_height) { var aspect_ratio=new_width/new_height; if(new_height<box_height) { new_height=box_height; new_width=Math.round(new_height*aspect_ratio); } if(new_width