Skip to content

takes a QCF font and return coordinated word by word database with images

Notifications You must be signed in to change notification settings

fai9al7dad/quran-image-with-coordinates-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quran image with coordinates generator

a script that takes a KFGQPC (King Fahd Glorious Quran Printing Complex) font and generates line by line images with each word coordinates and updates the database with x_start,x_end,y_start,y_end coordinates.

Prerequisites

  • python (tested on python 3.10)
  • pillow package
  • sqlite3 package
  • QCF font from here. should also work with the old one and a new one if released
  • a database (available on clone)

the database

its a custom database that is scrapped from quran com api. added some missing stuf like bismillah location and surah names with its lines and fixed some bugs. the goal was to get line by line for every page, instead of the whole text as once. see source code

database schema

database schema

database in practice

database in practice

tuning variables

in the main.py you can configure how the output images look

# --- Tuning variables
CANVAS_WIDTH = 1080
CANVAS_HEIGHT = 174
FONT_SIZE = 65
H_PADDING = 0
V_PADDING = 19
SHOW_MAREKRS = False
IS_THICK_TEXT = False # makes the text more thick
SHOW_BBOX = False # shows bbox around each glyph
PAGE_RANGES = [1, 604]
OUTPUT_FOLDER = "output/"
# --- End of tuning variables

example output

with

....
SHOW_BBOX = True
SHOW_MARKERS = True
IS_THICK_TEXT = False
IS_TRANSPARENT = False
....

and with a white background output example 1

with

....
SHOW_BBOX = False
SHOW_MARKERS = False
IS_THICK_TEXT = True
IS_TRANSPARENT = True
....

and trasnparent background

output example 2

usage

  1. download packages
  2. put fonts folder in root
  3. run main.py
  4. run compress.py (recomended)

or just download the images from here and download the database from this repo and enjoy :)

credits

huge thanks to quran.com community for providing their api and fonts

About

takes a QCF font and return coordinated word by word database with images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages