programmatically creating things that look handwritten

2,433 Views | 8 Replies | Last: 2 yr ago by CapCity12thMan
CapCity12thMan
How long do you want to ignore this user?
AG
I bouncing around idea in my head where I would like to take some data, for example numbers from bowling and translating that into a handwritten-looking scorecard. So, if someone bowls a 10, an X is generated on a score sheet, and 8, translates into a written 8, etc etc. So in the end, it is a representation of a hand-written bowling scoresheet.

Sound like some image capabilities and rendering, but I cannot find the words or whatever to google on for this - there is a ton of stuff like OCR to translate handwriting to text, but I want to go the opposite direction.

I am just using bowling as an example, so don't need bowling specific direction.

another example:
tomtomdrumdrum
How long do you want to ignore this user?
AG
How real does the handwriting need to appear? There are lots of fonts out there that are designed to look like handwriting, but the letters will all be printed the same every time. If you don't care about it looking real, pick a font and write a program using some pdf generation library to create pdfs from data.

If you do care about it looking real, here's a fun video to watch on the subject:
CapCity12thMan
How long do you want to ignore this user?
AG
Yeah the actual letters and number is simple but I would need lines, circles, etc drawn in there and drawn in the right places so this is where it's different than just transcribing to fonts only
Mr President Elect
How long do you want to ignore this user?
AG
CapCity12thMan said:

Yeah the actual letters and number is simple but I would need lines, circles, etc drawn in there and drawn in the right places so this is where it's different than just transcribing to fonts only
You could use svg's for that or even a library of images and place them where they need to go.
aggiez03
How long do you want to ignore this user?
AG
Are you generating the scorecard / grid as well? Or you printing on an existing card?

If you are generating the scorecard, then I think you will need to look into programming for x,y coordinated drawing (should be plenty of drawing examples on line using python, or whatever language you want to use) to draw the lines needed as well as the header, footer, and text.

As far as the scoring translation...

I would store all data in a database, then create image files related to each score (using Roman Numerals for example: I, II, III, IV, V, etc) and then when you get to a number, you do an if-then test and substitute the jpg for the actual number.

You will need to make sure all image files are the same size (240 x 360) so that they will all fit in the same box and take up the same space.

Lots of trial and error to get it to fit correctly, but shouldn't be too bad.

If it a pre-printed card, then you will need to figure out where to print the image files and that will take a lot of trial and error and lots of measuring and trying again.

Someone mentioned a PDF creation library....

This is the way I would go as well. I created a purchase order system for my job about 10 years ago and one thing I added as a PDF generated copy to send to vendors. With that you basically created the PO line by line starting at the top of the page and I was able to put spaces, underlines, tabs, etc just like if you were using word or any other document generator.
kb2001
How long do you want to ignore this user?
AG
Above suggestions are good ones. If you want to take it a step further, you can have multiple different sets of circles, roman numerals, and numbers that are similar but slightly different and have it randomly select one. This gives a bit more realism.

An example I've started to see more recently is junk mail letters. They are really getting good at looking handwritten, printed on yellow paper that looks like legal pad paper. The word "the" has a few variations appear throughout, but is pretty close, mimicking a person's style of handwriting where it's the same motions but can appear slightly different.

A quick search for "generating handwritten notes" brings this site up:

https://www.calligrapher.ai/?ref=upstract.com
CapCity12thMan
How long do you want to ignore this user?
AG

Quote:

Are you generating the scorecard / grid as well? Or you printing on an existing card?

printing on an existing card, so yes the easy part is translating a 3 into an roman numeral image or some other handwritten image of a 3, yada yada, but data might be X and i need to translate that into a number with a circle on it, and then data Y it might just be a line, or Z might be a dot. So taking data and translating them into an image of text, number or line or other marking and getting it where it needs to go

EDIT: this looks promising: https://pdfkit.org/docs/vector.html
tomtomdrumdrum
How long do you want to ignore this user?
AG
Not a joke, you should tell chat gpt what you want the program to do and have it write JavaScript for you (so you can use that library you found). You probably can even reference the library by name and it will use it. If you don't know how to run the code it generates, you can ask it to help you with that too.

Interested to see if this approach works for someone with your level of experience and if it's helpful in teaching you how it works.
CapCity12thMan
How long do you want to ignore this user?
AG
yeah will try that...I found the library I know will work because I found someone doing what I wanted to do and he told me this is what he uses with Python: https://matplotlib.org/stable/gallery/text_labels_and_annotations/index.html

So, yet again another cool idea someone already grabbed.

EDIT: yay chatgpt:


Quote:

In this script:
[ol]
  • We send an API request to retrieve game data from xxxxxxxxxxx, specifying the endpoint for a specific game (replace "game/123456" with the actual game ID). You should adjust the endpoint and parameters according to your requirements.
  • If the API request is successful, we parse the game data.
  • We define a
    render_scorecard
    function to create a
    matplotlib
    figure and set up a basic scorecard layout. We add game information to the scorecard as an example, such as the date, home team, away team, and final score.
  • You can customize and add more elements to the scorecard as needed, including player information, scores, and notable plays.
  • Finally, we call the
    render_scorecard
    function with the retrieved game data to display the scorecard using
    matplotlib
    .
  • [/ol]
    Refresh
    Page 1 of 1
     
    ×
    subscribe Verify your student status
    See Subscription Benefits
    Trial only available to users who have never subscribed or participated in a previous trial.