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
Cut 3 pixels from the end of image and join it to the front
-
- Posts: 6
- Joined: 2018-05-10T08:00:26-07:00
- Authentication code: 1152
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Cut 3 pixels from the end of image and join it to the front
Code: Select all
magick VP_EQN_7.gif -roll -3+0 x.png
snibgo's IM pages: im.snibgo.com
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Cut 3 pixels from the end of image and join it to the front
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...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...
Code: Select all
convert input.gif -gravity northeast -background white \
\( -clone 0 -crop 3x0+0+1 -duplicate 1 \) -reverse +append -shave 0x3 output.gif
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!
-
- Posts: 6
- Joined: 2018-05-10T08:00:26-07:00
- Authentication code: 1152
Re: Cut 3 pixels from the end of image and join it to the front
Hi GeekMack,
I tried the command
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:
Ishan
I am using ubuntu with imagemagic 6.9.7-4.GeeMack wrote: ↑2018-05-10T16:14:27-07:00Code: Select all
convert input.gif -gravity northeast -background white \ \( -clone 0 -crop 3x0+0+1 -duplicate 1 \) -reverse +append -shave 0x3 output.gif
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 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:
Thanks a lot,I know there are no free lunches, so I am willing to buy a beer to the one who helps me out!
Ishan
-
- Posts: 6
- Joined: 2018-05-10T08:00:26-07:00
- Authentication code: 1152
Re: Cut 3 pixels from the end of image and join it to the front
Hi GeekMack,
I got the desired result using.
Please let me know how to buy you a beer!
Thanks a lot for the direction.
Cheers,
Ishan
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
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Cut 3 pixels from the end of image and join it to the front
Looks like your "-crop" argument should be "+0+0", with a "+" instead of that "x".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
PayPal: gmcneil@mtco.comPlease let me know how to buy you a beer!