0

I have been pretty successful in copying the antique style of old books which I described here: How to generate old antique style books in LaTeX However, one thing is still missing. The roughness or irregularity or randomness in the font that were common in old prints cannot be reproduced in modern Latex by default. There was a post regarding this but I cannot find it anymore.

Anybody knows any package that can do this?

Masum
  • 1,009
  • 1
    I have a vague feeling that DEK, or maybe someone else, created a font where the characters had slightly different forms and dimensions, thus giving a rough appearance to the output. But, I can't find any reference to this. Perhaps someone else will have a better memory. – Peter Wilson Mar 19 '22 at 17:56
  • I am pretty sure I saw a post regarding this issue. But couldn't find anyting related at all – Masum Mar 20 '22 at 18:16

1 Answers1

1

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.

output

Masum
  • 1,009
  • Hi! I really like this plug-in, and it is almost exactly what I'm looking for for a themed document I'm making. One issue - if you import a multipage pdf in GIMP, each page is by default, opened in multiple layers. Unfortunately, I'm trying to run this on a many-page PDF. Do you have a good idea how this plug-in could be extended so that it runs this process on all layers, and then exports them all as a single PDF? Thank you! – Nine Thousand Apr 02 '23 at 19:34
  • 1
    Whoops, I guess I should have messed with image settings before asking. For anyone else using this for multiple page pdfs: import pdf in reverse order as IMAGES, not as LAYERS. It will do everything flawlessly. Thank you Masum! – Nine Thousand Apr 02 '23 at 19:42