Another Latex Converter 2 Image
This is a simple converter from latex to pillow images. The main function is latex_to_image. The input packages_and_commands must include all packages and custom enviroments, custom commands. Just write it as normal latex. In packages_and_commands do not use \begin{document} just simple usepacke stuff and commands! The content argument is the content that should be visualized. This literally can be annything. We are using a real latexcompiler in the backend. out_file_name is a string or None if you don't want a file to bewritten. dpi is the resolution. Higher is better but with more storage.
The output type is a pillow image so you can convert it to a numpy array with np.array(pillow_image) and then go from there. Also ofcourse you can safe it as png with pillow_image.save().
import easylatex2image
from easylatex2image import latex_to_image
packages_and_commands = r"""\usepackage[parfill]{parskip}
\usepackage[german]{varioref}
\usepackage{url}
\usepackage{amsmath}
\usepackage{dcolumn}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{intersections}
\usepackage[all,cmtip]{xy}
"""
content = r"""
\xymatrix{M \ar[d]_\kappa \ar[r]^f & A\\ K \ar[ur]_{f_K}}
"""
pillow_image = latex_to_image(packages_and_commands,content,"output.jpg",dpi=500,img_type="JPEG")
Also with the r before the string you can just pass the latex code as it is without \n or something like that.
Installation
The libary needs miktex (link: https://miktex.org) to be installed. If you have AVast installed miktex might not work. A possible solution would to
- go to menu
- go to settings.
- go to execptions.
- add pdflatex command as execption. Avast also might ask you if you want to make an execptions if you reboot.
Alternative Solution: Use Linux :)
Metadata
Release files for easylatex2image 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easylatex2image-0.0.1.tar.gz | 3.1 kB | Without provenance | Details for easylatex2image-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easylatex2image-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for easylatex2image-0.0.1-py3-none-any.whl |
Total release size: 7.4 kB
Release files / easylatex2image-0.0.1.tar.gz
| Download URL | easylatex2image-0.0.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3be3a262736e424dd86041a3dc0b4cb9e08a61ba3f396a1976dd97bd66e59314
|
|
BLAKE2b-256 checksum How to use checksums |
920be38961fa5d2bc17900bfee47329367ad9b1c4ab39c9aa3cab19722b5e544
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.6
|
Release files / easylatex2image-0.0.1-py3-none-any.whl
| Download URL | easylatex2image-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7d07f9c2b7427e804d6200fc7cfddf9cd79b78f9e115f685a37ffb14b5aa3c9
|
|
BLAKE2b-256 checksum How to use checksums |
e5b55e13567c0794c524d8d7e48c668f1d26e3e7858d14af770eff58bbdc447f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.6
|
Security for easylatex2image 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.