Open foolish-boy opened 8 years ago
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.
The attachments do not work.
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?
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