This can be done using GIMP. Learn the basics of GIMP so you can apply different effects on an image. Import your pdf in GIMP on a higher resolution (I use 400+ in pixels value and my monitor is 4k, play with this one). Also, place the following script in the plugins directory, for windows, this is located in C:\Users\<User>\AppData\Roaming\GIMP\2.10\plug-ins
from gimpfu import *
1012982852
2826674371
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'):
pdb.gimp_undo_push_group_start(image)
for subimage in gimp.image_list():
pdb.gimp_message('Antiquifying '+str(subimage.ID))
opacity = 80
pdb.gimp_context_set_opacity(opacity)
drawable = subimage.active_layer
pdb.plug_in_randomize_pick(image,drawable,rndm_pct, rndm_rcount, randomize, seed)
pdb.plug_in_spread(subimage,drawable,spread_amount_x, spread_amount_y)
# pdb.plug_in_spread(subimage,drawable,spread_amount_x, spread_amount_y)
pdb.plug_in_gauss_rle2(subimage,drawable,horizontal, vertical)
opacity = 97.2
pdb.gimp_context_set_opacity(opacity)
pdb.gimp_threshold(drawable, low_threshold, high_threshold)
pdb.gimp_undo_push_group_end(image)
pdb.gimp_message('All processing done. Creating pdf')
images = gimp.image_list()
# num_images, image_ids = pdb.gimp_image_list()
num_images = len(images)
image_ids = [subimage.ID for subimage in images]
pdb.file_pdf_save_multi(num_images, image_ids, False, False, False, filename, filename)
pdb.gimp_message('Pdf created at '+filename)
register(
"python-fu-antiquify",
"Make a LaTeX document antique",
"",
"Masum Billal",
"Masum Billal",
"2022",
"Antiquify",
"",
[
# basic parameters are: (UI_ELEMENT, "variable", "label", Default)
(PF_IMAGE, "image", "takes current image", None),
(PF_SLIDER, "rndm_pct", "Random Percent for Pick", 10, (0, 100, .5)),
(PF_SLIDER, "rndm_rcount", "Number of Iteration for Pick", 1, (0, 10, 1)),
(PF_BOOL, "randomize", "Randomize or not for Pick", True),
(PF_INT, "seed", "Seed of randomization for Pick", 1),
(PF_SLIDER, "horizontal", "Horizontal for Gaussian blur", .5, (0, 10, .5)),
(PF_SLIDER, "vertical", "Vertical for Gaussian blur", .5, (0, 10, .5)),
(PF_SLIDER, "low_threshold", "Threshold low", 200, (0, 255, 1)),
(PF_SLIDER, "high_threshold", "Threshold high", 255, (0, 255, 1)),
(PF_SLIDER, "spread_amount_x", "Horizontal spread", 2, (0, 20, 1)),
(PF_SLIDER, "spread_amount_y", "Vertical spread", 2, (0, 20, 1)),
(PF_STRING, "filename", "PDF Filename", None),
],
[],
antiquify,
menu="<Image>/Filters/Noise",
)
main()
Obviously, you can play around with the values and add/remove effects. Do that and get the desired amount of antiquity you want. Here is an example output.
