Remove two surfaces of image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Thom
Posts: 3
Joined: 2015-06-29T10:43:51-07:00
Authentication code: 6789

Remove two surfaces of image

Post by Thom »

Hello,

I have 300+ images of the same format below, and I want to remove the grey surfaces of the picture, so the final image need to be the blue surface with the measurements of 720x550 px.

Can someone help me with a commandline script to do that.
All the images are in the same folder.

Thanks in advange!

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove two surfaces of image

Post by fmw42 »

Are the gray and blue areas always the same size and color? Are they always labeled with the sizes? What version of IM are you using (convert -version) and what platform?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Remove two surfaces of image

Post by snibgo »

convert UX8qK.png -crop 720x550+0+50 +repage x.png
snibgo's IM pages: im.snibgo.com
Thom
Posts: 3
Joined: 2015-06-29T10:43:51-07:00
Authentication code: 6789

Re: Remove two surfaces of image

Post by Thom »

fmw42 wrote:Are the gray and blue areas always the same size and color? Are they always labeled with the sizes? What version of IM are you using (convert -version) and what platform?
Yeah the areas are always the same, but not the same color, but I make it in the drawing so to simplify my question. I am using version "6.9.1--6 Q16" And I am running Windows 8.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Remove two surfaces of image

Post by snibgo »

Does my command do the job?
snibgo's IM pages: im.snibgo.com
Thom
Posts: 3
Joined: 2015-06-29T10:43:51-07:00
Authentication code: 6789

Re: Remove two surfaces of image

Post by Thom »

snibgo wrote:convert UX8qK.png -crop 720x550+0+50 +repage x.png
This Works! Great!

Do you know how to convert a whole folder? Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove two surfaces of image

Post by fmw42 »

Yeah the areas are always the same, but not the same color,
snibgo's command should do what you ask
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove two surfaces of image

Post by fmw42 »

see mogrify at http://www.imagemagick.org/Usage/basics/#mogrify

create a new empty directory, so that you do not write over your existing files, for example test2. Assuming your images are in test1, then

Code: Select all

cd test1
mogrify -path pathto/test2 -format png -crop 720x550+0+50 +repage *.png
Also see
http://www.imagemagick.org/Usage/crop/#crop_repage
Post Reply