Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Is there something wrong with the method - (UIImage *)trimmedImage:(UIImage *)image in DZNPhotoEditorViewController.m? #127

Open
foolish-boy opened this issue Jun 29, 2016 · 3 comments

Comments

@foolish-boy
Copy link

foolish-boy commented Jun 29, 2016

I use this method in my project and found some error.

I have some questions for this methods:

1: what does "loc" mean? why compute it like that?

2: In my project, i found that the top/bottom value may be wrong, which results in black edge in pic.

3: should cropRect.size be ((right.x - left.x + 1)/scale, (bottom.y - top.y + 1)/scale)?

i.stack.imgur.com/sFxlr.jpg
i.stack.imgur.com/JOz1Z.jpg

@foolish-boy
Copy link
Author

foolish-boy commented Jun 30, 2016

I finally found that the width is incorrect, and that just results in black edge.

in my project, i got 690 by method following:
width = CGImageGetWidth(CGImageRef )
but i got 690 by other method like this:
size_t bpr = CGImageGetBytesPerRow(inImage); //2784
size_t bpp = CGImageGetBitsPerPixel(inImage); // 32
size_t bpc = CGImageGetBitsPerComponent(inImage); //8
size_t bytes_per_pixel = bpp / bpc; // 4
size_t width = bpr / bytes_per_pixel;

I dont know why they are not equal.

@dzenbot
Copy link
Owner

dzenbot commented Jul 6, 2016

The attachments do not work.

@foolish-boy
Copy link
Author

yes, the attachments do not work, you just need know that there are black edges on bottom or top of pic.

I have fixed the problem by compute width like this: size_t width = bpr / bytes_per_pixel;

I dont know why, is it a bug?

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

No branches or pull requests

2 participants