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

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



does it work any better with:
  surf_1 = surf.subsurface((0,0,50,50)).copy()

... convert_alpha should make it have alpha, which may be bad for jpeg, while copy should keep everything as it was

On Sat, May 17, 2008 at 4:24 PM, 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