Hi Guys,
Apologies if this is simple, but I'm trying to call ImageMagick from a command line in VB (little irrelevant!)
I would like to crop the image, and save the image as the current file name. I'm assuming from the docs I need the -shave command line argument but here's where I think it gets complicated.
Some of my images are the correct size, and some are not. I would like ImageMagick to be able to take the sides from the image (i.e. make it 480 x 640) as long as it is a predefined image size (i.e. if it's 1024 x 768 - then -shave - otherwise leave it alone!)
If you're still reading this, the application is for photo ID, and the webcam we're using (after switching) only takes landscape pics, and the end user wants portrait - as all of their current images are portrait... hence the need to not crop or shave their current images (which although they are portrait, they are of no fixed size) - therefore the only way of determining which is a new image is the dimensions of the image.
If you can help, thanks a million - and thanks for even just reading this far!
All the best,
Pete
Cropping Image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cropping Image
Depending upon what parts you want to remove, your choices are -crop, -shave or -chop. see http://www.imagemagick.org/Usage/crop/ and look further downs for -shave and -chop.
Unfortunately, IM has no internal ability (to my knowledge) to test for image size (except in -resize). Therefore you will need to do that test in VB prior to calling your IM command. However, I am not a Windows/VB user, so cannot advise further. You may find some help in http://www.imagemagick.org/Usage/windows/
Unfortunately, IM has no internal ability (to my knowledge) to test for image size (except in -resize). Therefore you will need to do that test in VB prior to calling your IM command. However, I am not a Windows/VB user, so cannot advise further. You may find some help in http://www.imagemagick.org/Usage/windows/