GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

How to display square video in top of preview view?

Open randyarrowood opened this issue 14 years ago • 3 comments

Thanks for putting this together, fantastic resource.

I've got my video previewing and saving in a square (480x480) output and use a GPUImageCropFilter. I'm currently working off of the SimpleVideoFilter example code and would like to move the preview area to the top of the view. I've tried setting the filterView's center and frame and nothing seems to change the fact that the square video preview is in the center of the view with black bars above and below. Any thoughts on how to shift it up to the top?

Thanks!

randyarrowood avatar Nov 01 '12 22:11 randyarrowood

If you want to overlay this on another image or video source, you could use a transform with a background color set to an alpha of 0 to scale down and move your source image, and then do an alpha blend to overlay it on your larger image.

BradLarson avatar Nov 01 '12 22:11 BradLarson

Thanks for the fast reply. When I port this to my app, it will eventually be the base background view/layer. I'll have some other views on top of it. I'd just like the top of the videoCamera to be at the top of the screen and right now there's a black bar at the top. This is what I'm trying...

GPUImageView *filterView = (GPUImageView *)self.view; [filter addTarget:filterView]; filterView.fillMode = kGPUImageFillModePreserveAspectRatio; self.view.center = CGPointMake(160.0, 160.0);

On Nov 1, 2012, at 6:55 PM, Brad Larson [email protected] wrote:

If you want to overlay this on another image or video source, you could use a transform with a background color set to an alpha of 0 to scale down and move your source image, and then do an alpha blend to overlay it on your larger image.

— Reply to this email directly or view it on GitHub.

randyarrowood avatar Nov 01 '12 23:11 randyarrowood

I think I have what I want... setup a view in the XIB called squareView...

GPUImageView *filterView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 320.0)]; [filter addTarget:filterView]; filterView.fillMode = kGPUImageFillModePreserveAspectRatio; [squareView addSubview:filterView];

randyarrowood avatar Nov 01 '12 23:11 randyarrowood