Page 1 of 1
Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T08:15:47-07:00
by joshiishan
Hi guys,
I am a new user.
I need to bulk edit images as the legacy image exporter gives me weirdly broken images.
I need to cut 3px from the end of the image and join it to the front with 1px up-shift.
Can someone please guide me on how can I make this happen? Even a small direction would help...
I know there are no free lunches, so I am willing to buy a beer to the one who helps me out!
Thanking you,
Ishan
Re: Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T08:26:27-07:00
by snibgo
Code: Select all
magick VP_EQN_7.gif -roll -3+0 x.png
Re: Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T16:14:27-07:00
by GeeMack
joshiishan wrote: ↑2018-05-10T08:15:47-07:00I need to cut 3px from the end of the image and join it to the front with 1px up-shift.
Can someone please guide me on how can I make this happen? Even a small direction would help...
You could use a simple "-roll" operation except you need to shift that last 3 pixel wide section up one, so it has to be handled separately. A command like this should work with IM6 in a *nix shell or script...
Code: Select all
convert input.gif -gravity northeast -background white \
\( -clone 0 -crop 3x0+0+1 -duplicate 1 \) -reverse +append -shave 0x3 output.gif
You would use "magick" instead of "convert" if you're using IM7. If you're working from a Windows command line or BAT script you need to remove those backslashes that escape the parentheses and replace the continued line backslash "\" with a caret "^"..
To do a batch conversion, use a command like that in a "for" loop to process all the files. Exactly how to do that depends on what sort of system you're running it on.
I know there are no free lunches, so I am willing to buy a beer to the one who helps me out!
Re: Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T16:55:45-07:00
by joshiishan
Hi GeekMack,
GeeMack wrote: ↑2018-05-10T16:14:27-07:00
Code: Select all
convert input.gif -gravity northeast -background white \
\( -clone 0 -crop 3x0+0+1 -duplicate 1 \) -reverse +append -shave 0x3 output.gif
I am using ubuntu with imagemagic 6.9.7-4.
I tried the command
Code: Select all
convert _VP_EQN_6.GIF -gravity northeast -background white \( -clone 0 -crop 3x0+0+1 -duplicate 1 \) -reverse +append -shave 0x3 output.gif
It generates this image:
It seems the 1 on the right side of the image is stamped on the left and the whole image is reduced by 1px
You got it right that the -roll won't work as I just need to vertical shift the last 3px part of the image and then roll the image. I am new to the scripting so I was not able to play much with the script though, I am trying and reading the help.
Noted:
I know there are no free lunches, so I am willing to buy a beer to the one who helps me out!
Thanks a lot,
Ishan
Re: Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T17:52:20-07:00
by joshiishan
Hi GeekMack,
I got the desired result using
Code: Select all
convert _VP_EQN_1.GIF -gravity northeast \( -clone 0 -crop 3x0+0x0 -duplicate 1 -roll +0-1 \) -reverse +append -shave 3x0 output.png
.
Please let me know how to buy you a beer!
Thanks a lot for the direction.
Cheers,
Ishan
Re: Cut 3 pixels from the end of image and join it to the front
Posted: 2018-05-10T19:42:12-07:00
by GeeMack
joshiishan wrote: ↑2018-05-10T17:52:20-07:00I got the desired result using
Code: Select all
convert _VP_EQN_1.GIF -gravity northeast \( -clone 0 -crop 3x0+0x0 -duplicate 1 -roll +0-1 \) -reverse +append -shave 3x0 output.png
.
Looks like your "-crop" argument should be "+0+0", with a "+" instead of that "x".
Please let me know how to buy you a beer!
PayPal:
gmcneil@mtco.com