Ejemplo n.º 1
0
    def on_karma_ok(self, e):
        image = Gtk.Image.new_from_file("images/karma_0.png")
        pixbuf = image.get_pixbuf()
        #pixbuf.save("/images/karma_99.png", "png")
        p = pixbuf.scale_simple(384, 384, InterpType.NEAREST)
        image.set_from_pixbuf(p)
        img = [item * 0xFF for sublist in self.img * 4 for item in sublist]
        print img
        data = GLib.Bytes(img)  #Pixbuf.GBytes([1, 2, 3, 4], 4)
        print len(data.get_data())
        colorspace = pixbuf.get_colorspace()
        new = Pixbuf.new_from_bytes(data, colorspace, True, 8, 24, 24, 24 * 4)
        image.set_from_pixbuf(new)

        new.savev("images/karma_99.png", "png", [], [])
        print("New Karma created")
        self.drawbox.hide()
Ejemplo n.º 2
0
    def on_karma_ok(self, e):
        image = Gtk.Image.new_from_file ("images/karma_0.png")
        pixbuf = image.get_pixbuf()
        #pixbuf.save("/images/karma_99.png", "png")
        p = pixbuf.scale_simple(384, 384, InterpType.NEAREST)
        image.set_from_pixbuf(p)
        img = [item*0xFF for sublist in self.img*4 for item in sublist]
        print img
        data = GLib.Bytes(img)#Pixbuf.GBytes([1, 2, 3, 4], 4)
        print len(data.get_data())
        colorspace = pixbuf.get_colorspace()
        new = Pixbuf.new_from_bytes(data, colorspace, True, 8, 24, 24, 24*4)
        image.set_from_pixbuf(new)

        new.savev("images/karma_99.png", "png", [], [])
        print("New Karma created")
        self.drawbox.hide()