yashlamba / yashlamba/handwrite
BUG: Unable to create font using jpg
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 543
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
- Traceback:
❯ handwrite Downloads/sa\ handwrite\ font_1\ \(1\).jpg .
Traceback (most recent call last):
File "/home/saahil/anaconda3/envs/handwrite/bin/handwrite", line 8, in <module>
sys.exit(main())
File "/home/saahil/anaconda3/envs/handwrite/lib/python3.7/site-packages/handwrite/cli.py", line 57, in main
args.input_path, args.output_directory, args.directory, args.config, metadata
File "/home/saahil/anaconda3/envs/handwrite/lib/python3.7/site-packages/handwrite/cli.py", line 34, in converters
run(sheet, output_directory, directory, config, metadata)
File "/home/saahil/anaconda3/envs/handwrite/lib/python3.7/site-packages/handwrite/cli.py", line 12, in run
SHEETtoPNG().convert(sheet, characters_dir, config)
File "/home/saahil/anaconda3/envs/handwrite/lib/python3.7/site-packages/handwrite/sheettopng.py", line 49, in convert
characters_dir,
File "/home/saahil/anaconda3/envs/handwrite/lib/python3.7/site-packages/handwrite/sheettopng.py", line 160, in save_images
images[0],
cv2.error: OpenCV(4.5.4) /tmp/pip-req-build-3129w7z7/opencv/modules/imgcodecs/src/loadsave.cpp:799: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'
- Dependencies:
❯ fontforge -v
Copyright (c) 2000-2021. See AUTHORS for Contributors.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
with many parts BSD <http://fontforge.org/license.html>. Please read LICENSE.
Version: 20201107
Based on sources from 2021-11-27 12:18 UTC-ML-D-GDK3.
Based on source from git with hash: 58238cc173c80379d0d4616971fc793da26c6aa4
fontforge 20201107
build date: 2021-11-27 12:18 UTC
❯ potrace -v
potrace 1.16. Copyright (C) 2001-2019 Peter Selinger.
Library version: potracelib 1.16
Default unit: inches
Default page size: letter
❯ conda list
# packages in environment at /home/saahil/anaconda3/envs/handwrite:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
_openmp_mutex 4.5 1_gnu
ca-certificates 2021.10.26 h06a4308_2
certifi 2021.10.8 py37h06a4308_0
handwrite 0.3.0 pypi_0 pypi
ld_impl_linux-64 2.35.1 h7274673_9
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h5101ec6_17
libgomp 9.3.0 h5101ec6_17
libstdcxx-ng 9.3.0 hd4cf53a_17
ncurses 6.3 h7f8727e_2
numpy 1.21.4 pypi_0 pypi
opencv-python 4.5.4.60 pypi_0 pypi
openssl 1.1.1l h7f8727e_0
pillow 8.4.0 pypi_0 pypi
pip 21.2.2 py37h06a4308_0
python 3.7.11 h12debd9_0
readline 8.1 h27cfd23_0
setuptools 58.0.4 py37h06a4308_0
sqlite 3.36.0 hc218d9a_0
tk 8.6.11 h1ccaba5_0
wheel 0.37.0 pyhd3eb1b0_1
xz 5.2.5 h7b6447c_0
zlib 1.2.11 h7b6447c_3
- Images used:

Fitted to A4 size using Adobe Scan

Original image scanned using Adobe Scan
- Operating system used:
❯ neofetch
██████████████████ ████████ saahil@saahil-gl638rd
██████████████████ ████████ ---------------------
██████████████████ ████████ OS: Manjaro Linux x86_64
██████████████████ ████████ Host: GL63 8RD REV:1.0
████████ ████████ Kernel: 5.10.79-1-MANJARO
████████ ████████ ████████ Uptime: 4 hours, 59 mins
████████ ████████ ████████ Packages: 1564 (pacman)
████████ ████████ ████████ Shell: bash 5.1.8
████████ ████████ ████████ Resolution: 1920x1080
████████ ████████ ████████ WM: i3
████████ ████████ ████████ Theme: Matcha-dark-sea [GTK2], Numix [G
████████ ████████ ████████ Icons: Papirus-Dark [GTK2/3]
████████ ████████ ████████ Terminal: kitty
████████ ████████ ████████ CPU: Intel i7-8750H (12) @ 4.100GHz
GPU: NVIDIA GeForce GTX 1050 Ti Mobile
GPU: Intel CoffeeLake-H GT2 [UHD Graphi
Memory: 3189MiB / 15850MiB
- Tried both conda and python venv environments, but it failed in both with the same error shared above.
- Python version 3.7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the reported handwrite JPG command, then inspect handwrite/cli.py and handwrite/sheettopng.py, especially save_images at the reported line. Confirm what produces the empty image passed to OpenCV and verify that the command generates the expected font without the imwrite error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, python
- Domain
- cli, computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100