Skip to main content

Convert markdown tables to PNG images

Project description

table-to-image

Convert pandas DataFrame tables to PNG images.

Installation

pip install table-to-image

Usage

As a Python Library

import pandas as pd
from table_to_image import render

# Create a DataFrame
df = pd.DataFrame({
    'Name': ['Alice', 'Bob', 'Charlie'],
    'Age': [25, 30, 35],
    'City': ['NYC', 'LA', 'Chicago']
})

# Convert to image
render(df, 'output.png')

# With custom options
render(df, 'output.png', font_size=16, header_bg_color=(255, 0, 0))

Using the Class

import pandas as pd
from table_to_image import DataFrameToImage

df = pd.DataFrame({'A': [1, 2], 'B': ['x', 'y']})

converter = DataFrameToImage(font_size=18, header_bg_color=(0, 128, 0))
converter.convert(df, 'table.png')

CLI

# Convert CSV to PNG
table-to-image input.csv output.png

# Convert with custom font size
table-to-image input.csv output.png --size 20

# Convert Excel file
table-to-image data.xlsx output.png

Options

Option Description Default
font_size Font size for text 14
header_bg_color Header background color (RGB tuple) (70, 130, 180)
header_text_color Header text color (RGB tuple) (255, 255, 255)
cell_bg_color Cell background color (RGB tuple) (255, 255, 255)
cell_text_color Cell text color (RGB tuple) (0, 0, 0)
margin Margin around the table 10

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

table_to_image-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

table_to_image-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file table_to_image-0.1.0.tar.gz.

File metadata

  • Download URL: table_to_image-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for table_to_image-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50998604093093ef928d1d5344acdd6d6d234f293c7c683c41fc5c04079a23bf
MD5 82984844aa3038baff669e643a98072f
BLAKE2b-256 861d58247e578d802ab45930365974f400ce6acb66784578cb7142cec740f2e9

See more details on using hashes here.

File details

Details for the file table_to_image-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: table_to_image-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for table_to_image-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a816af8dfc7d7f96acb9c3fecaf65aa7d9c3b696b606fe8137d5427a2d01a52c
MD5 bef29113b87f28b11136bf39b4516f1f
BLAKE2b-256 3fd14bab29625fc1274ed31d966f824ee44d1a56f1946fdcc2cae21a6973f297

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page