png.c 663 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #define _XOPEN_SOURCE
  2. #include "img.h"
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. int main(){
  6. pix_row rows[1920];
  7. pix p;
  8. char filename[60];
  9. int i,j,x,y,count;
  10. image img;
  11. p.r = 200;
  12. p.g = 200;
  13. p.b = 200;
  14. for (count=0; count<(3600*60);count++){
  15. for (i=0;i<1920;i++){
  16. rows[i].p = malloc (1080 * sizeof(pix));
  17. for (j=0 ;j<1080; j++){
  18. p.r = (int) (drand48() * 255);
  19. p.g = (int) (drand48() * 255);
  20. p.b = (int) (drand48() * 255);
  21. rows[i].p[j] = p;
  22. }
  23. }
  24. sprintf(filename, "images/image%5d.png", count);
  25. img = initialize_png("image010", filename, 1920, 1080);
  26. write_image(&img, rows);
  27. finish_image(&img);
  28. }
  29. return (0);
  30. }