Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by abredall
-
RE: Unable to paste one PIL image onto another
@ccc Ahhh good catch! and Very helpful with your more Pythonic revision. I don't code too regularly so it helps a lot. Thanks!
-
Unable to paste one PIL image onto another
So I'm trying to build a script with the Pillow module that will put a border around a selected image so all photos I upload will have the same minimum border width. However, contrarcy to the PIL documentation, I keep getting the error: "images do not match". It was my understanding that the only prerequisite to paste onto another image was the number of bands?
Below is my code. You can see in my comments near the bottom that I've even compared two identically generated images. If I change either of the first two arguments, I receive the error.
import Image as img from photos import pick_asset, get_image size = (1080, 1080) max = size[0]*.85 og = pick_asset(multi=True) for pic in og: shortest = 1 longest = 1 pic = pic.get_image() pic.convert('RGB') pic_size = list(pic.size) # creating the background border = img.new('RGB', size, 'white') border2 = img.new('RGB', (400,400), 'white') # determing which side is longest if pic_size[0] > pic_size[1]: longest = pic_size[0] shortest = pic_size[1] if pic_size[0] < pic_size[1]: longest = pic_size[1] shortest = pic_size[0] # resizing as needed divisor = shortest/longest multiplier = longest/shortest x = round(pic_size[0]*divisor) y = round(pic_size[1]*divisor) x2 = round(pic_size[0]*multiplier) y2 = round(pic_size[1]*multiplier) if longest > max: # pic too big. scale pic down pic.resize((x, y)) if longest < max: # pic too small. scale down bg border.resize((x2, y2)) new_pic = pic.copy() #final_pic = border.paste(pic) #print(str(pic_size[0]) + ", " + str(pic_size[1])) #final_pic = border.paste(border2) #final.save()
`
-
RE: Defining a Line up/Line down keyboard function
@7upser I actually didn’t know the space bar had a similar effect. It actually works pretty well, but only works on the default iOS keyboard. I was hoping to find a solution that worked on PyKeys (ideally in my navigation bar next so it’s one click and done)
-
RE: Defining a Line up/Line down keyboard function
@cvp I couldn’t seem to get this to work on the standard iOS keyboard or PyKeys and couldn’t find any related setting either
-
Defining a Line up/Line down keyboard function
So I've been trying to figure out if it would be posible to define a function to navigate between lines. For those with big fingers using iOS, it can be frustrating to constantly have to hold just to navigate one exactly one line above/below where you tapped.
Fortunately Pythonista includes functions to navigate left/right, but this is what makes me think this may simply be a feature request. However, I figured there must be some workaround I’m missing.
-
Building a mini-game in the Pythonista Keyboard
I was wondering if it would be possible to build a super simple game to be played on the thin one-row bar above the pythonista keyboard?
My first guess was to try to feed my Scene to the add_subview method of my main ui.View class, but this method obviously requires another View, not a Scene. Is there a way to wrap a scene in a view for this purpose? I feel like using a SceneView instead might help, but I can't quite wrap my head around the implementation, as I'm very new to Python.