Hey guys,
is it possible to extend the outermost pixels of an image the same way OpenGL's GL_CLAMP_TO_EDGE does it?
(See https://solarianprogrammer.com/2013/05/ ... -textures/)
[SOLVED] How to extend image borders
[SOLVED] How to extend image borders
Last edited by Lecram on 2018-08-05T23:33:30-07:00, edited 1 time in total.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to extend image borders
The edges of an image may be extended like your example by using -distort SRT and -virtual-pixel edge. An example running IM7 from a Windows command line might look like this...
Code: Select all
magick input.png -set option:distort:viewport %[fx:w*2]x%[fx:h*2] ^
-virtual-pixel edge -distort srt "0,0 1 0 %[fx:w/2],%[fx:h/2]" output.png
EDITED: Fixed punctuation in the command.
Last edited by GeeMack on 2018-08-06T07:11:08-07:00, edited 1 time in total.
Re: How to extend image borders
Thank you very much!
My OS is Ubuntu 17.10 x64_64 4.13 and I'm using ImageMagick 6.9.7-4 Q16 x86_64 20170114.
Your solution worked for me right after I replaced the x with a comma in the SRT part. Here's the full command (linux terminal):
Here's the relevant documentation for future reference:
My OS is Ubuntu 17.10 x64_64 4.13 and I'm using ImageMagick 6.9.7-4 Q16 x86_64 20170114.
Your solution worked for me right after I replaced the x with a comma in the SRT part. Here's the full command (linux terminal):
Code: Select all
#!/bin/bash
convert "in.png" \
-set option:distort:viewport %[fx:w*2]x%[fx:h*2] \
-virtual-pixel Edge \
-distort SRT "0,0 1,1 0 %[fx:w/2],%[fx:h/2]" \
"out.png"