Automated image processing.

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
chor
Posts: 2
Joined: 2014-06-19T08:16:17-07:00
Authentication code: 6789

Automated image processing.

Post by chor »

Listing my ideal solution here, but open to better methods.
Would like to add images to a folder, then they are automatically cropped, unrotated, and named. If the naming could be read from the card that would be awesome. Not too hopefully for that feature though. Seems like it would be a lot of work.

What I have done so far:
I have messed with this for just a bit. Bought a book, but just don't have time.
I tested multicrop and unrotate scripts, but they fell short of the task. I probably just don't know how to use them.
I then had some stencils made from plastic with slots for the cards. I've went in and used coordinates to crop the image. But don't have this scripted, so I basically copied the image 6 times then ran 6 different commands to crop out the cards. Then rotated after.

I would like this to be as efficient as possible. It would probably be better to rotate the image first, instead of 6 times at the end. Some won't need rotated though. Also would like to get rid of the blanks when there are some. This is where I need someone with the ability. There will also be a couple different sized stencils later that I would like to be able to easily edit the sizes in the script. Nothing is set in stone on this, so if you have a better way, let me know. I would ideally like a customized duplex scanner that could do each card quickly, but don't have the $$$$$ for that one.

I intend to process this on a centos 6 vm. Not sure the time commitment or a fair rate on this, so we can negotiate that.

Hopefully these images load and you can see what I start with and what I would like to end with. If you need more let me know.


Image

Image

Image

Image

Image

Image

Image

Image

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

Re: Automated image processing.

Post by fmw42 »

Your scanned images have a whitish border outside a blackish border and is a jpg image, so that background color is not consistent. So you must remove the whitish border first before passing to multicrop and use a moderate fuzz value. Try the following. It works for me. You can play with the fuzz value for the multicrop.

Code: Select all

convert CLX_3180_20140505_12533108.jpg -bordercolor white -border 10 \
-fuzz 50% -trim -shave 2x2 -rotate 90 miff:- |\
 multicrop -f 20 - CLX_3180_20140505_12533108_trim_mcrop.png
chor
Posts: 2
Joined: 2014-06-19T08:16:17-07:00
Authentication code: 6789

Re: Automated image processing.

Post by chor »

Thanks for the quick response. Works much better. Not quite sure what the options mean, but looks much better.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Automated image processing.

Post by fmw42 »

Code: Select all

convert CLX_3180_20140505_12533108.jpg -bordercolor white -border 10 \
-fuzz 50% -trim -shave 2x2 -rotate 90 miff:- |\
 multicrop -f 20 - CLX_3180_20140505_12533108_trim_mcrop.png
In the first part, I add a white border of 10 pixels, then do a fuzzy trim using 50% fuzz value to remove the white as much as possible, since your image has white surrounding the black background. To be safe, I shave off 2 pixels all around. Then I rotate your image 90 degrees. The result (in miff format) is piped to multicrop where I just specify a fuzz value (-f) of 20 (pct) and the default coordinate of 0,0 which finds something close to black, which then does a fuzzy floodfill to convert your background to transparent. The script then finds and writes to output all the isolated images it extracts.
Post Reply