Skip to content

Instantly share code, notes, and snippets.

@kostyll
Created August 8, 2015 10:40
Show Gist options
  • Select an option

  • Save kostyll/a0cf2a84736d1a6282f0 to your computer and use it in GitHub Desktop.

Select an option

Save kostyll/a0cf2a84736d1a6282f0 to your computer and use it in GitHub Desktop.
xxxx
im1 = 'eNMItpUG.png'
im1
im1_path = 'eNMItpUG.png'
from PIL import Image
im1 = Image.open(im1_path)
im1
im1.fromstring()
im1.getim
im1.getim()
im1.tostring()
im1_bytes = im1.tobytes()
im1_bytes
im2 = Image.frombytes(im1_bytes)
im1_string = im1.tostring()
im2 = Image.fromstring(im1_string)
im1.text
im1.getdata
im1.getdata()
im1_data = im1.getdata()
im1_data
im1_data.mode
im1.mode
im1.save
from StringIO import StringIO
StringIO()
im1_iostring = StringIO()
im1.save(im1_iostring)
im1.save(im1_iostring)
im1.save(im1_iostring.buf)
im1.save(im1_iostring)
im1_iostring = StringIO()
from io import BytesIO
im1_iofile = BytesIO()
im1.save(im1_iofile)
im1_iofile = BytesIO().open()
im1_iofile = BytesIO()
im1_iofile.isatty
im1_iofile.isatty()
im1.save(im1_iofile, format="png")
im2 = Image.open(im1_iofile)
im1_iofile.seek(0)
im2 = Image.open(im1_iofile)
im2.save('222.png')
%hist
%hist
im1_iofile
im1_iofile.getvalue
im1_iofile.getvalue()
im1_iofile.getvalue()[:100]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment