Skip to content

Instantly share code, notes, and snippets.

@berberman
Created January 21, 2024 21:43
Show Gist options
  • Select an option

  • Save berberman/3dc7901237bbcb4724349ebc04d59872 to your computer and use it in GitHub Desktop.

Select an option

Save berberman/3dc7901237bbcb4724349ebc04d59872 to your computer and use it in GitHub Desktop.
PJSK sticker to Telegram sticker
#! /usr/bin/env -S NIXPKGS_ALLOW_UNFREE=1 nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: with p; [ shake ])" imagemagick steam-run
module Main where
import Development.Shake
import Development.Shake.FilePath
main :: IO ()
main = shake shakeOptions $ do
action $ do
files <- liftIO $ getDirectoryFilesIO "." ["*.png"]
need ["result/resized" </> takeBaseName f <.> "png" | f <- files]
"result/*.png" %> \out -> do
let src = takeBaseName out <.> "png"
need [src]
cmd_
Shell
"steam-run"
"waifu2x-ncnn-vulkan-20220728-ubuntu/waifu2x-ncnn-vulkan"
"-i"
(show src)
"-o"
(show out)
"-n"
"2"
"-s"
"2"
"result/resized/*.png" %> \out -> do
let src = "result" </> takeBaseName out <.> "png"
need [src]
cmd_ Shell "convert" (show src) "-resize \"512>\"" (show out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment