I love that image.delivery pulls the prompt out of the image metadata (so myself and others can reference it later), but it doesn’t support albums… Prompt for above

  • skrewlews@lemm.eeOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    10 months ago

    This works great! I wrote a python script to make it faster.
    Obviously, modify to fit your needs…

    Input file:

    https://image.delivery/page/fbdyibj
    https://image.delivery/page/gpbbxpn
    https://image.delivery/page/zgojtmp
    

    Output file will look like this:

    Click on an image to see prompt details.
    
    [![](https://fast.image.delivery/fbdyibj.jpg)][1]
    [![](https://fast.image.delivery/gpbbxpn.jpg)][2]
    [![](https://fast.image.delivery/zgojtmp.jpg)][3]
    
    [1]: https://image.delivery/page/fbdyibj
    [2]: https://image.delivery/page/gpbbxpn
    [3]: https://image.delivery/page/zgojtmp
    

    Script:

    def convert_urls(input_file, output_file):
        with open(input_file, 'r') as f:
            urls = f.read().splitlines()
    
        with open(output_file, 'w') as f:
            f.write('Click on an image to see prompt details.\n\n')
            for i, url in enumerate(urls, start=1):
                id = url.split('/')[-1]
                f.write(f'[![](https://fast.image.delivery/{id}.jpg)][{i}]\n')
    
            f.write('\n')
    
            for i, url in enumerate(urls, start=1):
                f.write(f'[{i}]: {url}\n')
    
    # Usage
    convert_urls('input.txt', 'output.txt')