Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Submitted on February 21, 2025 at 11:57 PM
Expires on March 23, 2025 at 11:57 PM (1 month from now)

New Paste 1 (Text)

import pixie
import miscMath
import std/strutils

type
  PalConv* = object
    outp*: string

proc `mkPalConv`*(
  inputFname: string
): PalConv =
  var img = readImage(inputFname) 

  result.outp.add "[\n" 
  for j in 0 ..< img.height:
    for i in 0 ..< img.width:
      if (
        (
          j mod pxSubSizeY == 0x0
        ) and (
          i mod pxSubSizeX == 0x0
        )
      ):
        var rgbx = img.unsafe[i, j]
        let color = rgbx.color().asRgb
        result.outp.add "  "
        #result.outp.add color
        var toAdd: uint16 = 0
        #toAdd = (toAdd shl 5) or 
        toAdd = toAdd or color.b
        toAdd = (toAdd shl 5) or color.g
        toAdd = (toAdd shl 5) or color.r
        result.outp.add "0x"
        result.outp.add toHex(toAdd)
        result.outp.add ",\n"
        #result.outp.add 
  result.outp.add "]\n"