omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. abredall

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 7
    • Best 0
    • Controversial 0
    • Groups 0

    abredall

    @abredall

    0
    Reputation
    561
    Profile views
    7
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    abredall Unfollow Follow

    Latest posts made by abredall

    • RE: Unable to paste one PIL image onto another

      @mikael @ccc It's working wonders now, thank you! Just a dumb mistake as usual. Great link too!

      posted in Pythonista
      abredall
      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!

      posted in Pythonista
      abredall
      abredall
    • 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()
      

      `

      posted in Pythonista
      abredall
      abredall
    • 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)

      posted in Pythonista
      abredall
      abredall
    • 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

      posted in Pythonista
      abredall
      abredall
    • 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.

      posted in Pythonista
      abredall
      abredall
    • 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.

      posted in Pythonista
      abredall
      abredall