Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FREQ] Cropped preview? #27

Open
feelingsonice opened this issue Jun 27, 2024 · 4 comments
Open

[FREQ] Cropped preview? #27

feelingsonice opened this issue Jun 27, 2024 · 4 comments
Assignees
Labels

Comments

@feelingsonice
Copy link

feelingsonice commented Jun 27, 2024

Is there a way to crop the preview and capture photos exactly like the cropped preview?

@feelingsonice feelingsonice changed the title Custom sized view? Cropped preview? Jun 27, 2024
@deden
Copy link

deden commented Jun 28, 2024

@feelingsonice, I think you should implement Custom Preview for that

MCameraController()
    .outputType(.video)
    .gridVisible(false)
    .cameraPosition(.back) 
    .mediaPreviewScreen(CroppedPreview.init)
                
struct CroppedPreview: MCameraPreview {
    let capturedMedia: MijickCameraView.MCameraMedia
    let namespace: Namespace.ID
    let retakeAction: () -> ()
    let acceptMediaAction: () -> ()
// crop implementation
}

@feelingsonice
Copy link
Author

@deden any tip on how to actually do that? I ran into a wall trying to do that with my own AVCaptureVideoPreviewLayer and couldn’t figure it out. Hence I’m now trying to see if there’s any third party libraries that could support this :(

@FulcrumOne
Copy link
Contributor

@feelingsonice, were you able to solve your problem on your own?

If not please let me know, I'll try to create a demo project for you this week.

@feelingsonice
Copy link
Author

I ended up not actually "cropping" the preview but fitFill a smaller rectangle on screen. When the user captures a photo, I crop it to the preview frame with something like this.

I think this works fine for my use case but would love to know how to actually crop out of curiosity. If it's a lot of work for you don't worry about it though :)

Thanks for the help!

@FulcrumOne FulcrumOne changed the title Cropped preview? [FREQ] Cropped preview? Nov 19, 2024
@FulcrumOne FulcrumOne moved this to Backlog in Camera Roadmap Nov 19, 2024
@FulcrumOne FulcrumOne self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

3 participants