Tool um rotierte Bildausschnitte aus Bildstapeln zu schneiden
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

scancropper2.pde 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import drop.*;
  2. SDrop drop;
  3. Bounder bounder;
  4. int imageNo = 0;
  5. int imageAmount;
  6. String[] imageList;
  7. PImage[] images;
  8. boolean imageLoaded;
  9. String folderURI;
  10. void setup() {
  11. size(240, 100);
  12. frameRate(30);
  13. drop = new SDrop(this);
  14. surface.setResizable(true);
  15. bounder = new Bounder();
  16. }
  17. void draw() {
  18. background(255);
  19. fill(0);
  20. text("Drop image folder here", 52, 53, 20);
  21. if (imageLoaded) {
  22. if (images[imageNo] != null) {
  23. image(images[imageNo], 0, 0, width, height);
  24. }
  25. }
  26. bounder.update();
  27. bounder.display();
  28. }
  29. void keyPressed() {
  30. if (key == ENTER) {
  31. if (bounder.state >= 3) {
  32. println("Compiling images");
  33. bounder.compile();
  34. println("Compiling finished, reset bounder");
  35. //bounder.state = 0;
  36. }
  37. }
  38. if (key == ' ') {
  39. bounder.state = 0;
  40. println("Bounder reset");
  41. }
  42. if (key == CODED) {
  43. if (keyCode == RIGHT) {
  44. imageNo++;
  45. if (imageNo > imageAmount) imageNo = imageAmount;
  46. else setImage(imageNo);
  47. println(imageNo);
  48. } else if (keyCode == LEFT) {
  49. imageNo--;
  50. if (imageNo < 0) imageNo = 0;
  51. else setImage(imageNo);
  52. println(imageNo);
  53. }
  54. }
  55. }
  56. void mousePressed() {
  57. bounder.click();
  58. }
  59. void setImage(int i) {
  60. imageLoaded = false; //seperate threat not present ladida
  61. images[i] = loadImage(imageList[imageNo]);
  62. imageLoaded = true;
  63. }
  64. void dropEvent(DropEvent theDropEvent) {
  65. if (theDropEvent.isFile()) {
  66. File myFile = theDropEvent.file();
  67. if (myFile.isDirectory()) {
  68. File[] droppedFiles = myFile.listFiles();
  69. println(droppedFiles);
  70. folderURI = droppedFiles[0].getParent();
  71. println(folderURI);
  72. imageAmount = droppedFiles.length-1; // assuming all files in folder are images
  73. images = new PImage[imageAmount];
  74. imageList = new String[imageAmount];
  75. for (int i = 0; i < imageAmount; i++) {
  76. imageList[i] = droppedFiles[i].toString();
  77. }
  78. imageList = sort(imageList);
  79. setImage(imageNo);
  80. /*for (int i = 0; i < imageAmount; i++) {
  81. images[i] = loadImage(droppedFiles[i].toString());
  82. println("hi");
  83. } // braucht zu lang die scheisse */
  84. }
  85. }
  86. }