Last active
December 14, 2021 08:36
-
-
Save themixray/b8c059c2d06ac8524eb089a7815aca45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import filedialog | |
from tkinter import Tk | |
import pickle | |
import pygame | |
import bz2 | |
import os | |
os.system('cls') | |
def ofd(): | |
root = Tk() | |
root.withdraw() | |
f = filedialog.askopenfilename() | |
root.destroy() | |
return f | |
d = pygame.image.load(ofd()) | |
d = [pygame.image.tostring(d,"RGBA"),d.get_size()] | |
d = bz2.compress(pickle.dumps(d)) | |
print(f'import bz2,pickle,pygame;img=pygame.image.fromstring(*pickle.loads(bz2.decompress({repr(d)})),"RGBA");del bz2,pickle,pygame') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment