yackle / CLImageEditor

MIT License
2.21k stars 573 forks source link

Disable some options and multiple images ? #57

Closed shubhank008 closed 10 years ago

shubhank008 commented 10 years ago
  1. Is it possible to disable some image editing options I dont want to use or rather load the options I want to use ? Lets say I don't want advanced options like curves etc. is it done by tool.available = NO; example in readme ?
  2. Any possibility to load and edit multiple images at once ? Something like a collage or such, like add 2 images and edit them together, there should be some possibility since you can add multiple emoticons or frames/stickers. I had a workaround idea of possibily adding a duplicate tool option based on stickers and load images from album to it to add additional images like stickers, but that won't be a clean thing over main image
yackle commented 10 years ago
  1. It is possible by tool.available = NO;
  2. It is not possible.
shubhank008 commented 10 years ago

Is it possible to center the tools ? I am using it for a iPad app in landscape mode (more editing area) and tools are kinda aligned to left only

screenshot 2014-09-05 02 26 39

yackle commented 10 years ago

It is not possible in default. You should rewrite the code yourself.

shubhank008 commented 10 years ago

this is a downer for ipad use :/ Can you hint me at the particular code or files I should try to modify to make that centered

yackle commented 10 years ago

When it comes to menu layouts, how about #49 ?

shubhank008 commented 10 years ago

wow thanks, I think I found out what I was looking for :)

Question: In your sample code we are pushing editor on a pickerVC, so after image is done edited I push it to another VC and dismiss the editor Now what if I want to come back to re-edit the image from my preview VC

If I don't dismiss the editorVC, even after my sugue push to previewVC editor window stays on top, and if I dismiss it and come back from previewVC, I return to my initial screen to select image rather then re-edit current image edit.

Any work around for this ? I am pretty sure its related to pushing or presenting editorVC on my main nav bar or something but just want some hints

shubhank008 commented 10 years ago

My last question to you after above if you don't mind, is there any way to display a "image mask" like a guideline while editing main image ?

I am creating a app for a edible paper print app and the edited image is placed in circle/square templates of a page, so once we put it and any frame/sticker/text goes out of bound in template, we need to edit it from start

So if a mask of the template was available over image while editing, taht would be perfect

screenshot 2014-09-05 16 32 59 screenshot 2014-08-11 16 37 17

yackle commented 10 years ago

Regarding the first question, I couldn't understand what is a problem.

About image mask, I think that you should to modify the code to suit the purpose.

shubhank008 commented 10 years ago

Basically I was asking when we click done and in delegate push view to a new VC, and form that VC want to come back to the editor to again keep re-editting same image (kind of image edit session), to do that is.

I will check the code where CLIE creates the main view to see if its just as simple as adding a imageview and decrease its alpha

yackle commented 10 years ago

It seems to me that the editor keeps editing result, is it wrong? Or you mean you want to rollback to the initial image?

shubhank008 commented 10 years ago

nope since you dismiss editor VC, so when to return back it doesn't exist anymore, and you are back to initial screen from where you pick the images (a separate VC)

My code

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

    //Image Editor Init
    editor = [[CLImageEditor alloc] initWithImage:image];
    editor.delegate = self;

    //NSLog(@"%@", editor.toolInfo);
    NSLog(@"%@", editor.toolInfo.toolTreeDescription);

    CLImageToolInfo *tool = [editor.toolInfo subToolInfoWithToolName:@"CLToneCurveTool" recursive:NO];
    tool.available = NO;     // if available is set to NO, it is removed from the menu view.
    CLImageToolInfo *tool2 = [editor.toolInfo subToolInfoWithToolName:@"CLDrawTool" recursive:NO];
    tool2.available = NO;
    CLImageToolInfo *tool3 = [editor.toolInfo subToolInfoWithToolName:@"CLStickerTool" recursive:NO];
    tool3.title = @"Icons";     // if available is set to NO, it is removed from the menu view.
    CLImageToolInfo *tool4 = [editor.toolInfo subToolInfoWithToolName:@"CLEmoticonTool" recursive:NO];
    tool4.title = @"Frames";

    [picker pushViewController:editor animated:YES];
}

- (void)imageEditor:(CLImageEditor *)editor didFinishEdittingWithImage:(UIImage *)image
{
    //self._imageView.image = image;
    //[self refreshImageView];

    [editor dismissViewControllerAnimated:YES completion:nil];

    FPdataModel *dm = [FPdataModel sharedManager];
    dm.tmpMainImg = image;

    FPAppDelegate *app = (FPAppDelegate *)[[UIApplication sharedApplication] delegate];
    UIViewController *currentController = app.window.rootViewController;
    _svcNav = (UINavigationController*)currentController;

    [self performSegueWithIdentifier:@"previewVC" sender:nil];

}

//Selector to return back to editor, from my preview VC
-(void)didExitEditing:(NSNotification*)notify{
    FPAppDelegate *app = (FPAppDelegate *)[[UIApplication sharedApplication] delegate];

    [UIView transitionWithView:self.navigationController.view.window
                      duration:0.65
                       options:UIViewAnimationOptionTransitionFlipFromRight
                    animations:^{

                        app.window.rootViewController = _svcNav;

                    }
                    completion:nil];
}
yackle commented 10 years ago

What's wrong with pushing preview VC?

- (void)imageEditor:(CLImageEditor *)editor didFinishEdittingWithImage:(UIImage *)image
{
    if([editor.parentViewController isKindOfClass:[UIImagePickerController class]]){
        UIViewController *vc = your preview VC
        [(UIImagePickerController*)(editor.parentViewController) pushViewController:vc animated:YES];
    }
}
yackle commented 10 years ago

And why don't you change an image by [[CLImageEditor alloc] initWithImage:image]?