您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

50 行
1.0 KiB

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