PMXBOT Log file Viewer

Help | Karma | Search:

#pil logs for Wednesday the 8th of October, 2014

(Back to #pil overview) (Back to channel listing) (Animate logs)
[15:09:09] <dG___> Hey guys
[15:09:26] <dG___> I'm still a noob in python and I have a quick question: I'm trying to create a pixelized image using PIL... Now, I have the code working using image.load(file), BUT, I'm trying to integrate this code into a different app and the image resource that I get there is not the same type of object I have from iamge.load, instead is a PIL.Image._ImageCrop
[15:09:26] <dG___> object
[15:09:37] <dG___> how do I get the actual image from that object?
[15:16:16] <wiredfool> .load()
[15:16:30] <wiredfool> ImageCrop is lazy, load makes it happen
[15:24:59] <dG___> that returns a PixelAccess object
[15:25:20] <dG___> I'm trying to get to PIL.JpegImagePlugin.JpegImageFile object
[15:37:18] <wiredfool> So, internally, PIL.Image is the core image object. ImageCrop is a lazy version of that
[15:37:44] <wiredfool> the JpegImagePlugin.JpegImageFile is a version of the image that you get only after reading a JPEG image
[15:38:11] <wiredfool> so, depending on how you were going to use the pixels, you could either:
[15:38:33] <wiredfool> im_crop.load(); im.getpixel(x,y)
[15:38:35] <wiredfool> or
[15:38:49] <wiredfool> im_crop.save(file, 'JPEG')
[15:38:51] <wiredfool> or
[15:39:00] <wiredfool> im_crop.tobytes()
[15:39:28] <wiredfool> (most operations have an implicit load in them to retrieve and decode the pixels from whatever they're in)
[15:39:57] <wiredfool> So, really, JpefImageFile is an implementation detail that's irrelevant for your purposes
[15:40:35] <wiredfool> dG___:
[15:41:40] <dG___> Got ir wiredfool
[15:41:51] <dG___> that helped a lot, everything is working now :)
[15:44:01] <wiredfool> cool