public static void SaveJPG(string file, int destinationWidth, int destinationHeight, int sourceWidth, int sourceHeight, byte[] data) { IntPtr surface = GetScaledSurface(FlipImageData(sourceWidth, sourceHeight, 4, data), sourceWidth, sourceHeight, destinationWidth, destinationHeight); SDL_image.IMG_SaveJPG(surface, file, 100); SDL_FreeSurface(surface); }