Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

50 rader
996 B

  1. #include "config.h"
  2. #include "common.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <pipi.h>
  7. int main(int argc, char *argv[])
  8. {
  9. char *srcname = NULL, *dstname = NULL;
  10. pipi_image_t *img, *newimg, *tmp;
  11. pipi_histogram_t* histogram;
  12. int ret = 0;
  13. if(argc < 2)
  14. {
  15. fprintf(stderr, "%s: too few arguments\n", argv[0]);
  16. fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
  17. return EXIT_FAILURE;
  18. }
  19. srcname = argv[1];
  20. dstname = argv[2];
  21. img = pipi_load(srcname);
  22. if(!img) {
  23. fprintf(stderr, "Can't open %s for reading\n", srcname);
  24. }
  25. newimg = pipi_copy(img);
  26. pipi_free(img);
  27. tmp = pipi_copy(newimg);
  28. histogram = pipi_new_histogram();
  29. pipi_get_image_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B);
  30. pipi_render_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B);
  31. pipi_save(tmp, dstname);
  32. pipi_free(newimg);
  33. return ret;
  34. }