Code Monkey home page Code Monkey logo

ios-image-editor's People

Contributors

heitorfr avatar iellis avatar kvting avatar orarbel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-image-editor's Issues

implement in a basicViewController

I've tried to implement your part of code which launches DemoImageEditor from a basic view controller instead of starting if from the AppDelegate and I have an issue in MY code : "[DemoImageEditor setCropRect:]: unrecognized selector sent to instance" because is not HFImageFrameView which launches setCropRest but the own view. And I don't understand why. Basicaly I have a simple view with a button. I push the button to start UIImagePickerController in a (void) displayImagePickerWithSource where the *picker is instantieted with *library and *imageEditor which will be pushed to the DemoImageEditor.

HFImageEditorViewController can't handle paronams

If someone attempts to select and save a Panaroma image being feed it to HFImageEditViewController memory warnings are thrown and the device resets. Upon running on an iPhone 5 with Instruments, when a user attempts to crop and save (doneAction:) memory allocations spike to over 1.5 gb.

Overriding checkBounds to NO doesn't work

First, I'm setting it after initialization. Then I'm changing it in viewDidLoad method of my subclass. Checking is still turned on and I can't see any of 'outside' area into my image.

RCImageEditorViewController *viewController = [[RCImageEditorViewController alloc] initWithNibName:@"RCImageEditorViewController" bundle:nil];
[viewController setCheckBounds:YES];

// subclass

  • (void)viewDidLoad {
    [super viewDidLoad];

    self.checkBounds = NO;
    }

Image is blurry/not focused at the start

When first going into the image editing screen, the image appears blurry/ not focused for a couple seconds. Great library overall, but this bug will need to be fixed. Thanks!

Smoother Pan Gesture?

I found that I can't pan the image smoothly. When I pan the image upward, downward, to the right or to the left, it bounds the image to the original position.

I can, hardly to succeed, pan the image, when I pan it very very slowly.

May I ask for any measure that I can make to correct my situation?
I have set the "checkBounds" to "YES".

Thanks.

Image Scale.

Can I bound image to not scale below to corp area, as of now i can scale image as smaller then corp area. that's why at the time I am corp the image black background will come with result image.

Broken in Xcode 6.1 & iOS8 SDK - Simulator

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; kCGImageAlphaLast; 4096 bytes/row.

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGContextSetInterpolationQuality: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGContextTranslateCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGContextConcatCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGContextDrawImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Dec 1 11:49:13 Daniels-MacBook-Pro.local ImageEditor[72522] : CGBitmapContextCreateImage: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

Blank space colour

Hi, this is great, thank you.
I'm just wondering, when I resize an image smaller than the crop area, or move it outside the crop area, the blank space left behind appears white in the crop area, however the resulting image that is processed has black for the blank space.

Is there any way to sync these? I don't mind setting the crop view to show black or the result to use white, as long as they are the same?

Thanks

how to use with storyboard ?

Hi Heitorfr,

i have issues using your editor with storyboard.
i'm getting uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil' error.

how do i initialise it ?

cheers

des

when complete, how to back orignal view controller?

Hi,
i'm a newer for ios development.
when i use image-editor in a navigation controller,
how to close the crop image view and back to my orginal view controller?
attach my code, it's not work:(

thanks you...
c5cc17a3-0133-4f14-8faa-576caa379d6a

Better bound check.

Hello, It would be nice that instead of rejecting a pan action that gives a invalid pan that instead of rejecting it that it tries to correct it or at least limits the transforme so that the values do not go beyond the edges. the way it is now it difficult to get the image to the edges for example: right after the initial load try to set the image to the top left corner. you will not be able to get the top part.

Crashes with Panorama images

When trying to rotate and crop panorama images application crashes with message "Terminated due to memory error".

If images is not rotated before cropping then it works fine.

Works fine with normal images.

Any workaround for this?

Change crop size affect Source image size and result image

When i change the size if the cropsize lets say a size of 100x100, i obtain a sourceImageView as small as the cropView.

I have tried to change the cropzise without a reset, also i tried to change the size of the frame of the sourceimageView, it works sourceImageview big, cropView small. but then when i crop the result image its not the same one i selected to crop. (its like a crop of the upper part of the original crop selection)

I have read the code and tried to make changes so that i achieve the correct effect but im not able to do it so far. i think is related with the scale and the image transforms are done during the save operation.

not work in iOS8

it can show the image like before, but not able to crop it any longer

Crop rectangle is always a square?

Hello, hopefully I'm just doing something wrong here, but despite setting the cropSize property, I'm always getting a square crop area. Here's my code:

    HFImageEditorViewController *imageEditor = [[HFImageEditorViewController alloc] initWithNibName:@"ImageCropperView" bundle:nil];

    imageEditor.cropSize = CGSizeMake(312.0, 416.0);
    imageEditor.sourceImage = myImage;
    imageEditor.doneCallback = ^(UIImage *editedImage, BOOL canceled){
        if (canceled) {
            //do nothing
        } else {
            [self.myImageView setImage:editedImage];
        }
        [self.navigationController popViewControllerAnimated:NO];
    };
    [self.navigationController pushViewController:imageEditor animated:NO];

My "ImageCropperView" xib contains a toolbar at the bottom with the "done" and "cancel" buttons, and the frameView (of type HFImageEditorFrameView) fills the rest of the view.

...It doesn't seem that the value of imageEditor.cropSize has any effect whatsoever on the actual size of the crop rectangle. Otherwise, everything works swimmingly.

Any help would be immensely appreciated! Thanks.

camera view freeze

its working fine.but when i take photo and click back button in navigation bar camera vieww is freeze.
u have any idea.

Change crop rect position.

Right now the crop rect has to be centered for the image to output correctly.
I'd like to be able to define the position of the crop rect.

Rotation bound check fails

Hello I am trying to set a method to di a 90degree left or right rotation.
this as a side effect that the bound checking becomes invalid.

Not sure if I not setting some this I should or should not.

But this is my code below that I added to the HFImageEditorViewController

  • (void) rotate:(ImageRotationDirection)pOrientation
    {
    CGFloat rotation = 0;
    if (pOrientation == ImageRotationDirectionRight)
    {
    rotation = M_PI_2;
    }
    else
    {
    rotation = -M_PI_2;
    }

    CGAffineTransform transform = CGAffineTransformRotate(self.imageView.transform, rotation);
    CGRect rectA = self.imageView.frame;
    rectA = CGRectApplyAffineTransform(rectA, transform);
    CGFloat scale = self.cropRect.size.width/rectA.size.width;
    transform = CGAffineTransformScale(transform, scale/self.scale, scale/self.scale);
    [self checkBoundsWithTransform:transform];
    self.imageView.transform = self.validTransform;
    }

unable to import in swift

Hi
I am trying to add this to my project and noticed that I keep getting the following error:

/Users/gkemp/Documents/Inviqa/wowlive/wowlive/wowlive-Bridging-Header.h:8:9: 'ios-image-editor/HFImageEditorFrameView.h' file not found
when I can see the files in my Pods folder.

Can anyone advise how to import using swift bridging header?
eg
#import <ios-image-editor/HFImageEditorFrameView.h>

Layout Issues on iPhone 4/4s

When creating a XIB that uses Auto Layout and wiring everything up as described in the README, using a 320x320 frameView that has a centered X and Y, the image in the cropper is displayed slightly lower than the intended frame. This only occurs on the iPhone 4/4s and does not occur on the 5/5s.

See attached image.

ios simulator screen shot aug 1 2014 5 11 13 am

Rounded corners in the crop view

Would it be possible to make the crop square have rounded corners?
I already clip the image's corners, but would like it to be visible to the user where it will be clipped.

Any pointers?

Thanks

Disable cutting outside the image

Hello,

I'm using your library, I want that the picture don't be able to go out of the cut area.

I almost achieve this with the following modifications in the code:

The code is working but have a bug with the pitch, I would like to discuss this with you, please take a look to the code. Thanks!

For the Pan:

- (IBAction)handlePan:(UIPanGestureRecognizer*)recognizer
{
    if([self handleGestureState:recognizer.state]) {
        CGPoint translation = [recognizer translationInView:self.imageView];

        float availableXmove = self.imageView.frame.size.width - self.cropSize.width;
        float availableYmove = self.imageView.frame.size.height - self.cropSize.height;

        if ((availableXmove>0) || (availableYmove>0)){

            float availableXmoveLeft = (availableXmove / 2) - (_totalMoveX + (translation.x * self.scale));
            float availableXmoveRight = (availableXmove / 2) + (_totalMoveX + (translation.x * self.scale));
            float availableYmoveTop = (availableYmove / 2) + (_totalMoveY - (translation.y * self.scale));
            float availableYmoveButton = (availableYmove / 2) - (_totalMoveY - (translation.y * self.scale));

            if ((availableXmoveLeft>=0) && (availableXmoveRight>=0) &&
                (availableYmoveTop>=0) && (availableYmoveButton>=0)){
                //NSLog(@"puedo mover por X o Y");
                float avaliableX = ((availableXmove) / 2);

                _totalMoveX += translation.x * self.scale;

                if ((avaliableX>_totalMoveX) && ((-1*avaliableX)<_totalMoveX)){

                    CGAffineTransform transform = CGAffineTransformTranslate( self.imageView.transform, translation.x, 0);
                    self.imageView.transform = transform;

                    [recognizer setTranslation:CGPointMake(0, 0) inView:self.frameView];

                }else{
                    _totalMoveX -= translation.x * self.scale;
                }

                float avaliableY = ((availableYmove) / 2);

                _totalMoveY -= translation.y * self.scale;
                if ((avaliableY>_totalMoveY) && ((-1*avaliableY)<_totalMoveY)){

                    CGAffineTransform transform = CGAffineTransformTranslate( self.imageView.transform, 0, translation.y);
                    self.imageView.transform = transform;

                    [recognizer setTranslation:CGPointMake(0, 0) inView:self.frameView];

                }else{
                    _totalMoveY += translation.y * self.scale;
                }
            }   
        }else{
            //NSLog(@"Err");
        }   
    }
}

For the Pinch:

- (IBAction)handlePinch:(UIPinchGestureRecognizer *)recognizer
{
    if([self handleGestureState:recognizer.state]) {
        if(recognizer.state == UIGestureRecognizerStateBegan){
            self.scaleCenter = self.touchCenter;
        }

        float availableXmove = self.imageView.frame.size.width - self.cropSize.width;
        float availableYmove = self.imageView.frame.size.height - self.cropSize.height;
        availableXmove = availableXmove / 2;
        availableYmove = availableYmove / 2;
        float availableXmoveLeft   = availableXmove - _totalMoveX;
        float availableXmoveRight  = availableXmove + _totalMoveX;
        float availableYmoveTop    = availableYmove + _totalMoveY;
        float availableYmoveButton = availableYmove - _totalMoveY;

        if ((availableXmoveLeft>=0) && (availableXmoveRight>=0) &&
            (availableYmoveTop>=0) && (availableYmoveButton>=0)){
            NSLog(@"ok");

            if ( self.scale*recognizer.scale>=1){
                CGFloat deltaX = 0;//self.scaleCenter.x-self.imageView.bounds.size.width/2.0;
                CGFloat deltaY = 0;//self.scaleCenter.y-self.imageView.bounds.size.height/2.0;

                CGAffineTransform transform =  CGAffineTransformTranslate(self.imageView.transform, deltaX, deltaY);
                transform = CGAffineTransformScale(transform, recognizer.scale, recognizer.scale);
                transform = CGAffineTransformTranslate(transform, -deltaX, -deltaY);

                self.scale *= recognizer.scale;

                self.imageView.transform = transform;

                recognizer.scale = 1;
            }
        }else{
            NSLog(@"Err");
        }
    }
} 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.