Update of /cvsroot/freevo/freevo/lib/pyimlib2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22368
Modified Files:
thumbnail.c
Log Message:
do not scale images already small enough
Index: thumbnail.c
===================================================================
RCS file: /cvsroot/freevo/freevo/lib/pyimlib2/thumbnail.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** thumbnail.c 16 Apr 2005 19:40:30 -0000 1.1
--- thumbnail.c 16 Apr 2005 20:03:09 -0000 1.2
***************
*** 130,133 ****
--- 130,146 ----
else
tw = (iw * th) / ih;
+
+ /* scale image down to thumbnail size */
+ imlib_context_set_cliprect (0, 0, tw, th);
+ src = imlib_create_cropped_scaled_image (0, 0, iw, ih, tw, th);
+ if (!src) {
+ imlib_free_image_and_decache ();
+ PyErr_SetString(PyExc_IOError, "pyimlib2 scale error");
+ return NULL;
+ }
+ /* free original image and set context to new one */
+ imlib_free_image_and_decache ();
+ imlib_context_set_image (src);
+
} else {
tw = iw;
***************
*** 139,157 ****
}
! imlib_context_set_cliprect (0, 0, tw, th);
!
! if ((src = imlib_create_cropped_scaled_image (0, 0, iw, ih, tw, th))) {
! imlib_free_image_and_decache ();
! imlib_context_set_image (src);
! imlib_image_set_has_alpha (1);
! imlib_image_set_format ("argb");
! snprintf (uri, PATH_MAX, "file://%s", source);
! if (_png_write (dest, imlib_image_get_data (), tw, th, iw, ih,
! format, mtime, uri)) {
! imlib_free_image_and_decache ();
! Py_INCREF(Py_None);
! return Py_None;
! }
! imlib_free_image_and_decache ();
}
--- 152,163 ----
}
! imlib_image_set_has_alpha (1);
! imlib_image_set_format ("argb");
! snprintf (uri, PATH_MAX, "file://%s", source);
! if (_png_write (dest, imlib_image_get_data (), tw, th, iw, ih,
! format, mtime, uri)) {
! imlib_free_image_and_decache ();
! Py_INCREF(Py_None);
! return Py_None;
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog