Search code examples
imagemagicktextures

Add overlap or duplicate pixels on texture bounds after cropping in imagemagick


I have huge texture Nx1024 pixels. I split it into several 1024x1024 textures with the following command with Imagemagick:

magick image.png -quality 100 -background none -resize x1024 -crop 1024x1024 -extent 1024x1024 output%02d.png

How can I add 2 pixels overlap on left and right sides of output images or duplicate pixels with imagemagick?

PS: I found the following case (-crop 3x1+2@) crop with equal size but it doesn't suit because I have an unknown width of the input image (it could be multiple of N for 1024)


Solution

  • If on Unix-based OS, then you could try my script, overlapcrop at http://www.fmwconcepts.com/imagemagick/index.php