Search code examples
fontsimagemagicklove2d

Add yellow line of pixels to image every 8 horizontal pixels


I have a very long image (824x8) of a bunch of characters from a font. I want to use the image as an image font in Love2D.

Love2D can take an image of a font with yellow lines (or any other color of line, really) in-between each character and convert it to a pixel-perfect font Love2D can use.

Here's an image that sorta shows what I want to do.

Is it possible to add these yellow lines with ImageMagick?

Edit: I am using the Windows command line.


Solution

  • If you need to just insert yellow lines into your existing image between every 8 pixel section, you can try something like this with Imagemagick ...

    convert input.png -background yellow ^
       -crop 8x0 -splice 1x0 +append +repage -crop 0x8 -splice 0x1 -append result.png
    

    That crops the image into 8 pixel wide strips vertically, adds a stripe of yellow to the left edge of each strip, then reassembles them. Then it crops the image horizontally into 8 pixel high strips, adds a single yellow edge to each, and reassembles them.

    That increases the final dimensions because it adds the yellow lines between rows of the input image rather than overlay a grid onto the input image.