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

  • Cavendish@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 months ago

    The method I’ve settled on takes a bit of work to put together. First, I upload PNGs to catbox.moe. This preserves metadata so someone can feed the image into the A1111 PNG Info tab, or by copying the url to https://pngchunk.com.

    Next, I upload JPG copies here. That gives me the lemmynsfw hosted url and builds the gallery. Then I put them both together using markdown so that the image gallery is also links to the PNGs. The final format looks like this:

    [![](https://lemmynsfw.com/pictrs/image/59c7f6e6-de70-4354-937b-5b82b67fc195.webp)][1]
    [![](https://lemmynsfw.com/pictrs/image/88b14211-4464-4cd2-bb28-05e781dd5fc8.webp)][2]
    [![](https://lemmynsfw.com/pictrs/image/bf3a69bb-d0f9-4691-b95e-6794880bbc86.webp)][3]
    
    [1]: https://files.catbox.moe/5dsqza.png
    [2]: https://files.catbox.moe/dljkxc.png
    [3]: https://files.catbox.moe/kcqguv.png
    

    This seems to work well. The only hiccup is that I need to include the first image twice, once in the post body so it shows in the gallery, and once as the post header image. That works okay in the browser, but some lemmy mobile apps show it as a duplicate.

    Here’s the final result: https://lemmynsfw.com/post/1372540

    • skrewlews@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 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')