diff --git a/.GitImages/texturetile01.png b/.GitImages/texturetile01.png index 495af77..3c6db8b 100644 Binary files a/.GitImages/texturetile01.png and b/.GitImages/texturetile01.png differ diff --git a/.GitImages/texturetile02.png b/.GitImages/texturetile02.png index c0298e0..a8d1ca6 100644 Binary files a/.GitImages/texturetile02.png and b/.GitImages/texturetile02.png differ diff --git a/.GitImages/texturetile03.png b/.GitImages/texturetile03.png index 9b0c73a..755624f 100644 Binary files a/.GitImages/texturetile03.png and b/.GitImages/texturetile03.png differ diff --git a/.GitImages/texturetile04.png b/.GitImages/texturetile04.png new file mode 100644 index 0000000..25c3b77 Binary files /dev/null and b/.GitImages/texturetile04.png differ diff --git a/Decorner/README.md b/Decorner/README.md new file mode 100644 index 0000000..8b57351 --- /dev/null +++ b/Decorner/README.md @@ -0,0 +1,6 @@ +Decorner +======== + +I made this so I can trim the corners off of screenshots of Windows 7 window frames, because they're rounded and I want the background to be transparent. + +It only works if the image is a perfect screenshot of the window. \ No newline at end of file diff --git a/Decorner/decorner.py b/Decorner/decorner.py new file mode 100644 index 0000000..f18fab5 --- /dev/null +++ b/Decorner/decorner.py @@ -0,0 +1,32 @@ +from PIL import Image +import sys + +imagename = sys.argv[1] +image = Image.open(imagename) +w = image.size[0] - 1 +h = image.size[1] - 1 +for i in range(5): + image.putpixel( (0, i), (0, 0, 0, 0)) + image.putpixel( (0, h-i), (0, 0, 0, 0)) + image.putpixel( (w, i), (0, 0, 0, 0)) + image.putpixel( (w, h-i), (0, 0, 0, 0)) +for i in range(3): + image.putpixel( (1, i), (0, 0, 0, 0)) + image.putpixel( (1, h-i), (0, 0, 0, 0)) + image.putpixel( (w-1, i), (0, 0, 0, 0)) + image.putpixel( (w-1, h-i), (0, 0, 0, 0)) +for i in range(2): + image.putpixel( (2, i), (0, 0, 0, 0)) + image.putpixel( (2, h-i), (0, 0, 0, 0)) + image.putpixel( (w-2, i), (0, 0, 0, 0)) + image.putpixel( (w-2, h-i), (0, 0, 0, 0)) + +image.putpixel( (3, 0), (0, 0, 0, 0)) +image.putpixel( (3, h), (0, 0, 0, 0)) +image.putpixel( (w-3, 0), (0, 0, 0, 0)) +image.putpixel( (w-3, h), (0, 0, 0, 0)) +image.putpixel( (4, 0), (0, 0, 0, 0)) +image.putpixel( (4, h), (0, 0, 0, 0)) +image.putpixel( (w-4, 0), (0, 0, 0, 0)) +image.putpixel( (w-4, h), (0, 0, 0, 0)) +image.save(imagename) \ No newline at end of file diff --git a/Decorner/test_after.png b/Decorner/test_after.png new file mode 100644 index 0000000..e86d961 Binary files /dev/null and b/Decorner/test_after.png differ diff --git a/Decorner/test_before.png b/Decorner/test_before.png new file mode 100644 index 0000000..9c4f9bc Binary files /dev/null and b/Decorner/test_before.png differ diff --git a/TextureTile/README.md b/TextureTile/README.md index 8180e5d..86b2781 100644 --- a/TextureTile/README.md +++ b/TextureTile/README.md @@ -18,4 +18,8 @@ Make it small! Make it any size at all!

texture tile +

+ +

+ texture tile

\ No newline at end of file diff --git a/TextureTile/texturetile.pyw b/TextureTile/texturetile.pyw index f46fa94..23b8373 100644 --- a/TextureTile/texturetile.pyw +++ b/TextureTile/texturetile.pyw @@ -9,8 +9,8 @@ class TextureTile: self.t = tkinter.Tk() self.t.title(self.windowtitle) - self.w = 450 - self.h = 475 + self.w = 500 + self.h = 525 self.screenwidth = self.t.winfo_screenwidth() self.screenheight = self.t.winfo_screenheight() self.windowwidth = self.w @@ -21,15 +21,19 @@ class TextureTile: self.t.geometry(self.geometrystring) self.entry_filename = tkinter.Entry(self.t, font=('Consolas', 12)) + self.spinbox_x = tkinter.Spinbox(self.t, width=2, from_=1, to=2 ** 13) + self.spinbox_y = tkinter.Spinbox(self.t, width=2, from_=1, to=2 ** 13) self.button_load = tkinter.Button(self.t, text='Load', command=self.file_load_display) self.frame_filearea = tkinter.Frame(self.t) self.label_image = tkinter.Label(self.frame_filearea, bg='#222') self.t.columnconfigure(0, weight=1) self.t.rowconfigure(1, weight=1) - self.entry_filename.grid(row=0, column=0, sticky='ew') - self.button_load.grid(row=0, column=1, sticky='ne') - self.frame_filearea.grid(row=1, column=0, columnspan=2, sticky='nsew') + self.entry_filename.grid(row=0, column=0, sticky='ew') + self.spinbox_x.grid(row=0, column=1) + self.spinbox_y.grid(row=0, column=2) + self.button_load.grid(row=0, column=3, sticky='ne') + self.frame_filearea.grid(row=1, column=0, columnspan=4, sticky='nsew') self.label_image.pack(expand=True, fill='both') #self.entry_filename.pack(fill='x') #self.button_load.pack() @@ -39,10 +43,20 @@ class TextureTile: self.entry_filename.bind('', self.file_load_display) self.entry_filename.focus_set() + self.spinbox_x.delete(0, 'end') + self.spinbox_x.insert(0, 3) + self.spinbox_y.delete(0, 'end') + self.spinbox_y.insert(0, 3) + self.t.mainloop() def file_load_display(self, *event): filename = self.entry_filename.get() + # I want to check the spinbox values up + # here so they can crash before wasting + # a file read. + xcount = int(self.spinbox_x.get()) + ycount = int(self.spinbox_y.get()) # Open file or turn red try: image = Image.open(filename) @@ -55,9 +69,9 @@ class TextureTile: w = image.size[0] h = image.size[1] expanded = image.copy() - expanded = expanded.resize((w * 3, h * 3)) - for x in range(3): - for y in range(3): + expanded = expanded.resize((w * xcount, h * ycount)) + for x in range(xcount): + for y in range(ycount): expanded.paste(image, (w*x, h*y)) # Resize 9x'ed image into frame