Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <assert.h>
  4.  
  5. #include "bmp.h"
  6.  
  7. int main(int argc, char** argv){
  8. colour** data = NULL;
  9. colour** crop_data = NULL;
  10. colour** rotate_data = NULL;
  11. unsigned char* header = (unsigned char*)malloc(54);
  12.  
  13. FILE* in = fopen(argv[2], "r");
  14. int w1, h1;
  15. data = load_bmp(in, header, &w1, &h1);
  16. fclose(in);
  17.  
  18. FILE* out = fopen(argv[3], "w");
  19. int x = h1 - 1 - atoi(argv[4]);
  20. int y = w1 - 1 - atoi(argv[5]);
  21. int w = atoi(argv[6]);
  22. int h = atoi(argv[7]);
  23.  
  24. crop_data = crop(data, x, y, w, h);
  25. rotate_data = rotate(crop_data, w, h);
  26. save_bmp(out, header, w, h, rotate_data);
  27. fclose(out);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement