By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

Creating an image by using RGB values

P: 4
Hi,

I have an excel file which contains RGB values of an image. I would like to know how to get the image from those RGB values. Can someone help me?

Thank you
Jan 17 '14 #1
Share this Question
Share on Google+
2 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
It's quite simple using PIL and xlrd. Read the Excel file with module xlrd and create the image using PIL.Image.new() and Image object method putdata. Here's an example of creating an image with PIL:
Expand|Select|Wrap|Line Numbers
  1. from PIL import Image
  2. im = Image.new("RGB", (255,100))
  3. data = [(x,x,x) for y in range(im.size[1]) for x in range(im.size[0])]
  4. im.putdata(data)
  5. im.save("pix.png") 
Jan 17 '14 #2

P: 4
Thank you very much.
Jan 17 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.