Skip to content

Export Image files to Excel File - Use Cells as Pixels

License

Notifications You must be signed in to change notification settings

SunnyBhuee/img2xl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

img2xl

Export Image files to Excel File - Use Cells as Pixels

Inspired by Matt Parker's YouTube video where he showed how image pixels can be expressed as Excel cells.

Description: This is a simple program that takes a user defined image file, optionally shrinks it, and then saves it in an Excel file at the same location of the original image's location.

Features:

  • User supplied image (.jpg or .png files) is converted from RGB to HEX pixels.
  • Individual cells of Excel sheet are treated as pixels of the image, and openpyxl.styles.PatternFill is used to color these cells according to the values of pixel colors.
  • Optinally, user can resize (shrink or expand) the image before exporting it to excel file as well.
  • Resulting Excel file is saved at the same location as original file.

Imports: Functions imports the following libraries. So ensure they are installed before using them.

import os
import PIL
import openpyxl

Usage:

from img2xl import img2xl

# Manual Inputs: Only the name of the image path
img_src = r'assets/dog.jpg'

# Calling functions from img2xl
img2xl(img_src, True, 0.2)

Sample Image
Sample Image

Resulting Image in Excel sheet after using img2xl
Results of img2xl

About

Export Image files to Excel File - Use Cells as Pixels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages