图片压缩后长度和宽度 及像素坐标

图片压缩后长度和宽度 及像素坐标

CGFloat    scaleFloat = 0.6;
+ (UIImage *) scaleImage: (UIImage *)p_w_picpath scaleFactor:(float)scaleFloat
{
    CGSize size = CGSizeMake(p_w_picpath.size.width * scaleBy, p_w_picpath.size.height * scaleBy);

    UIGraphicsBeginImageContext(size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGAffineTransform transform = CGAffineTransformIdentity;

    transform = CGAffineTransformScale(transform, scaleBy, scaleBy);
    CGContextConcatCTM(context, transform);

    // Draw the p_w_picpath into the transformed context and return the p_w_picpath
    [p_w_picpath drawAtPoint:CGPointMake(0.0f, 0.0f)];
    UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return newimg;  
}

然后imgData = UIImageJPEGRepresentation(p_w_picpath, 0.6f)
imgData UIImageJPEGRepresentation(p_w_picpath, scaleFloat)