fork download
  1. from gimpfu import *
  2.  
  3. # 1012982852
  4. # 2826674371
  5.  
  6. def antiquify(image, rndm_pct, rndm_rcount, randomize, seed, horizontal, vertical, low_threshold, high_threshold, spread_amount_x, spread_amount_y, filename='D:/Projects/integer-seqs/output.pdf'):
  7. pdb.gimp_undo_push_group_start(image)
  8. for subimage in gimp.image_list():
  9. pdb.gimp_message('Antiquifying '+str(subimage.ID))
  10. opacity = 80
  11. pdb.gimp_context_set_opacity(opacity)
  12. drawable = subimage.active_layer
  13. pdb.plug_in_randomize_pick(image,drawable,rndm_pct, rndm_rcount, randomize, seed)
  14. pdb.plug_in_spread(subimage,drawable,spread_amount_x, spread_amount_y)
  15. # pdb.plug_in_spread(subimage,drawable,spread_amount_x, spread_amount_y)
  16. pdb.plug_in_gauss_rle2(subimage,drawable,horizontal, vertical)
  17. opacity = 97.2
  18. pdb.gimp_context_set_opacity(opacity)
  19. pdb.gimp_threshold(drawable, low_threshold, high_threshold)
  20. pdb.gimp_undo_push_group_end(image)
  21. pdb.gimp_message('All processing done. Creating pdf')
  22. images = gimp.image_list()
  23. # num_images, image_ids = pdb.gimp_image_list()
  24. num_images = len(images)
  25. image_ids = [subimage.ID for subimage in images]
  26. pdb.file_pdf_save_multi(num_images, image_ids, False, False, False, filename, filename)
  27. pdb.gimp_message('Pdf created at '+filename)
  28.  
  29.  
  30. register(
  31. "python-fu-antiquify",
  32. "Make a LaTeX document antique",
  33. "",
  34. "Masum Billal",
  35. "Masum Billal",
  36. "2022",
  37. "Antiquify",
  38. "",
  39. [
  40. # basic parameters are: (UI_ELEMENT, "variable", "label", Default)
  41. (PF_IMAGE, "image", "takes current image", None),
  42. (PF_SLIDER, "rndm_pct", "Random Percent for Pick", 10, (0, 100, .5)),
  43. (PF_SLIDER, "rndm_rcount", "Number of Iteration for Pick", 1, (0, 10, 1)),
  44. (PF_BOOL, "randomize", "Randomize or not for Pick", True),
  45. (PF_INT, "seed", "Seed of randomization for Pick", 1),
  46. (PF_SLIDER, "horizontal", "Horizontal for Gaussian blur", .5, (0, 10, .5)),
  47. (PF_SLIDER, "vertical", "Vertical for Gaussian blur", .5, (0, 10, .5)),
  48. (PF_SLIDER, "low_threshold", "Threshold low", 200, (0, 255, 1)),
  49. (PF_SLIDER, "high_threshold", "Threshold high", 255, (0, 255, 1)),
  50. (PF_SLIDER, "spread_amount_x", "Horizontal spread", 2, (0, 20, 1)),
  51. (PF_SLIDER, "spread_amount_y", "Vertical spread", 2, (0, 20, 1)),
  52. (PF_STRING, "filename", "PDF Filename", None),
  53. ],
  54. [],
  55. antiquify,
  56. menu="<Image>/Filters/Noise",
  57. )
  58.  
  59. main()# your code goes here
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.7/py_compile.py", line 143, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./prog.py", line 1
    from gimpfu import *
    ^
IndentationError: unexpected indent

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/py_compile.py", line 147, in compile
    raise py_exc
py_compile.PyCompileError: Sorry: IndentationError: unexpected indent (prog.py, line 1)
stdout
Standard output is empty