Page 1 of 1
Resize-bend-resize script
Posted: 2018-11-13T09:16:15-07:00
by darkfrei
Hi all!
I know how resize, but what tool I can use for bending?
Now I need make a lot of images like that (magenta is for position):
Original image for example
image-01.png
Resize to 200x200
image-02.png (200x200 px)
Bend this image to (it's also 200x200)
image-03.png (200x200 px)
And resize it back to 20x20
image-04.png (20x20 px)
Re: Resize-bend-resize script
Posted: 2018-11-13T09:30:36-07:00
by GeeMack
darkfrei wrote: ↑2018-11-13T09:16:15-07:00I know how resize, but what tool I can use for bending?
You can use "-distort arc" to accomplish that. This command will do the 90° bend...
Code: Select all
convert input.png -background none -virtual-pixel none -distort arc "90 45 200 0" -shave 1 result.png
Learn more about using "-distort arc" to make bends and curves
at THIS link.
You may want to use "-scale" rather than "-resize" to scale up before the distort to avoid aliasing. If you're using IM version 7 use "magick" instead of "convert".
Re: Resize-bend-resize script
Posted: 2018-11-13T10:24:21-07:00
by darkfrei
Thanks, GeeMack!
I've also found another link
http://www.imagemagick.org/Usage/mapping/#circlar_arc and trying to undertand it.
Re: Resize-bend-resize script
Posted: 2018-11-13T10:53:35-07:00
by darkfrei
This part is too complicated:
Code: Select all
magick image-02.png -background none ^
-gravity East -extent 400x200 ^
-virtual-pixel none -distort Arc 180 image-180.png
Here I take
image-02.png (200x200 px), add another 200 pixels on the left (west) side.
But -distort makes this picture as 456x229 px
image-180.png (456x229)
Re: Resize-bend-resize script
Posted: 2018-11-13T13:36:45-07:00
by darkfrei
Looks amazing! Exactly what I want. For 32 pixels here is distort "...320...".
Code: Select all
magick "Input/*.png" ^
-scale 1000%% ^
-background none ^
-virtual-pixel none ^
-distort arc "90 45 320 0" -shave 1 ^
-scale 10%% ^
Output/bend_90_%%04d.png
pause
Re: Resize-bend-resize script
Posted: 2018-11-14T11:28:32-07:00
by darkfrei
Another question, but for the same project:
How to make from one image a lot of them but with shift? By paint dot net it calls "panelling", but it's very big work.
So I want to make from this picture 32x32:
this spritesheet with 32 elements, every sprite was shifted one pixel to the right.
Re: Resize-bend-resize script
Posted: 2018-11-14T11:33:18-07:00
by GeeMack
darkfrei wrote: ↑2018-11-14T11:28:32-07:00this spritesheet with 32 elements, every sprite was shifted one pixel to the right.
Try this...
Code: Select all
magick sprite1.png -duplicate 31 -roll +%[fx:t]+0 -append +repage sprites32.png