Hi,

up to now I create previews (smaller images) like this.

Has some one a hint how I can reduce the number of colors, to
reduce the file size?


def scale2file(width_max, height_max, filename, outfile):
    pixbuf=gtk.gdk.pixbuf_new_from_file(filename)
    width_orig=pixbuf.get_width()
    height_orig=pixbuf.get_height()
    width, height = max_width_height(
        width_orig, height_orig,
        width_max, height_max)
    pixbuf=pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
    if pixbuf:
        pixbuf.save(outfile, 'png')
    else:
        logging.error('pixbuf.scale_simple failed: %s' % filename)
        os.symlink(filename, outfile)



-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to