if (p.x2() - p.x1() > 10 && p.y2() - p.y1() > 10) {
double xs = image.getWidth();
double ys = image.getHeight();
Transform crop = ImagesServiceFactory.makeCrop(p.x1() / xs, p.y1() / ys, p.x2() / xs, p.y2() / ys);
OutputSettings jpeg = new OutputSettings(OutputEncoding.JPEG);
image = ImagesServiceFactory.getImagesService().applyTransform(crop, image, jpeg);
}
}
final ProfilePictureData profilePicture = ProfilePictureData.getProfilePicture(image.getImageData());