[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Alternative to pygame.Surface.subsurface



Are you using pygame 1.8?  Can you try a 1.8.1 pre-release build?
http://www.pygame.org/wiki/cvs



On Sun, May 18, 2008 at 9:24 AM, Brad Montgomery
<brad@xxxxxxxxxxxxxxxxxx> wrote:
> I know this a kind of an old thread, but does this trick work for file
> formats that don't have an alpha channel?
>
> On Fri, Oct 19, 2007 at 10:11 PM, Phil Hassey <philhassey@xxxxxxxxx> wrote:
>> Indeed... Anyway - this is how I would do it:
>> surf_1 = surf.subsurface((0,0,50,50)).convert_alpha()
>
> I'm writing an application that lets me crop images, and I just want
> to get a copy of an image using a Rect (keeping the part inside the
> Rect).
>
> However, when I save the image using pygame.image.save, I end up with
> corrupted images. I'm trying to save the new images as the same file
> type of the parent (ie: jpg). After saving and trying to open the
> image, I receive this:
> Error interpreting JPEG image file (Not a JPEG file: starts with 0x00 0x00)
>
> Thanks for any info.
>
> brad
>