Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Picture To Excel

DZone's Guide to

Picture To Excel

·
Free Resource
// description of your code here


import Image
from win32com.client import Dispatch
e=Dispatch('Excel.Application')
e.visible=0
q=1

try:
    im=Image.open(r'D:\picture.jpg')
    w,h=im.size
    print w
    for i in range(1,w/q):
        print i
        for ii in range(1,h/q):
            col=im.getpixel((i*q,ii*q))
            rgb=hex(col[2])[2:]+hex(col[1])[2:]+hex(col[0])[2:]
            e.cells(ii,i).Interior.Color=int(rgb,16)
except:
    e.visible=1
e. visible=1
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}