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

mask.inverted() doesn't seem to produce the desired effect #10

Open
Xcoder89 opened this issue Jul 21, 2017 · 4 comments
Open

mask.inverted() doesn't seem to produce the desired effect #10

Xcoder89 opened this issue Jul 21, 2017 · 4 comments

Comments

@Xcoder89
Copy link

Trying to implement a erase background feature using the transparent view mode so that the result image would be obtained by inverting the mask. But the mask.inverted().cutout() doesn't seem to produce the desired result.

@bingh0616
Copy link
Contributor

@Xcoder89 Thanks for reporting the issue. Can you tell us more about this? What is your desired result and what is the function actually outputs?

@asam139
Copy link

asam139 commented Jul 15, 2019

If you invert the mask the image is not cutout. Any help please?

@AdamWorld
Copy link

same problem here.
I drag to remove background and confirm.
But the result is background.
So I did mask.inverted().cutout(image, false).
But it removes nothing.

@asam139
Copy link

asam139 commented Aug 7, 2019

@AdamWorld This should help you :)

- (UIViewController *)tcMaskViewWillPushViewControllerWithMask:(TCMask *)mask image:(UIImage *)image {
  // Broken on TinyCrayon 5.0.1
  //TCMask *invertedMask = [mask inverted];
  NSMutableArray *newData = [NSMutableArray arrayWithCapacity:mask.data.count];
  for (NSNumber *n in mask.data) {
    [newData addObject:@(255 - n.unsignedIntegerValue)];
  }
  
  TCMask *invertedMask = [[TCMask alloc] initWithData:newData size:mask.size];
  UIImage *outputImage = [invertedMask cutoutWithImage:image resize:true];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants