0
# ...

def show():
    """
    Show image
    """
    t = Twitter(auth=authen())
    try:
        target = g['stuff'].split()[0]
        if target != 'image':
            return
        id = int(g['stuff'].split()[1])
        tid = c['tweet_dict'][id]
        tweet = t.statuses.show(id=tid)
        media = tweet['entities']['media']
        for m in media:
            res = requests.get(m['media_url'])
            img = Image.open(BytesIO(res.content))
            img.show()
    except:
        debug_option()
        printNicely(red('Sorry I can\'t show this image.'))

# ...

This is the section of code that the developer claims will open an image with the OS's default image viewer. For me, it opens it with imagemagick but I want it to open with feh. How can I change the OS's default image viewer?

1

Under the hood, PIL defaults to using the display command provided by ImageMagick to display image (or xv, if exists). If you want to open an image with other program, you might have to modify PIL's source, and here is how.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.