// try to compress it to JPEG
*buf = Z_Malloc(maxsize);
*size = JPEG_SaveImage_to_Buffer((char *) *buf, maxsize, image_width, image_height, newimagedata);
// try to compress it to JPEG
*buf = Z_Malloc(maxsize);
*size = JPEG_SaveImage_to_Buffer((char *) *buf, maxsize, image_width, image_height, newimagedata);