[Sugar-devel] [PATCH] implements http://bugs.sugarlabs.org/ticket/1106 - Browse: No preview in Journal for downloaded image

Gonzalo Odiard godiard at sugarlabs.org
Thu Sep 23 16:02:59 EDT 2010


> > +        if (width > preview_width) or (height > preview_height):
> > +            scale_x = float(width) / preview_width
> > +            scale_y = float(height) / preview_height
> > +            scale = max(scale_x, scale_y)
> > +
> > +            pixbuf = pixbuf.scale_simple(float(width) / scale, height /
> scale,
> > +                                     gtk.gdk.INTERP_BILINEAR)
>
>
I guess you meant "width / scale"? scale_simple() expects integers.
>

Yes


> If you use scale(), you can get rid of one pixbuf (currently you use up
> to three).
>
> Ok.



> > +        width, height = pixbuf.get_width(), pixbuf.get_height()
>
> > +        pixbuf2 = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
> pixbuf.get_has_alpha(),
> > +            pixbuf.get_bits_per_sample(), preview_width, preview_height)
>
> This creates a border around an image that's smaller than the preview
> size, thus wasting disk space. Please use width and height instead.
>
>
That isn't true. If the image doesn't have the right proportions, it's stretch
when displayed.


-- 
Gonzalo Odiard
SugarLabs Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100923/f2c068ac/attachment.htm 


More information about the Sugar-devel mailing list