topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 4:07 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Auto Cropping Book Cover Images  (Read 5623 times)

Relned1

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Auto Cropping Book Cover Images
« on: December 12, 2014, 06:51 PM »
Hi,

In my last post I mentioned I automatically grab an Image into Screenshot Captor from my Webcam, then Automatically Rotate this image using Screenshot Captors Auto Rotate Function and then Store the Image with an Appropriate Name. All if this is done by pressing a "SNAP" button in an Excel Dialog Box I created.  I use Autohotkeys to "Glue" Excel to Screenshot Captor".

After I have a file full of Images, I pull these images back into Screenshot Captor and Manually Crop them.

I would like to do this automatically as well when I first Capture the Image using Screenshot Captor.  Is there an Add-on to Screenshot Captor I could use to do this.   Presently the Images I am taking are of Book Covers have a Very Black Velvet Background.   This works very well for having Screenshot Captor Rotate the Images.  For most of the Book Covers I Crop out all the black background leaving just the  book cover.  

If there is not a way to do this using Screenshot Captor with an Add-on, does anyone know what would be a good program I could use to do this in a batch mode?  I would want to point the program to the file that contains the Book Cover Images and have it go through each Image automatically in a batch mode, cropping as I described above.

For some Images after I find the edge of the Book Cover, I would like to back off 1/2 or 3/4 of an inch and crop here leaving a black boarder around the image.  Does anyone know how I can do this Automatically as well?


Thanks In Advance

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #1 on: December 13, 2014, 07:47 AM »
A third party tool might be best for this -- especially for things like adding some extra borders.
However, I will note that if you enable the Scanner Functions of Screenshot Captor you will see a new toolbar and one of the items on it is AutoCrop, designed to remove the background borders.

Relned1

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #2 on: December 13, 2014, 11:31 AM »
Mouser,

I have been playing around with the Crop feature and so far I really like what I am seeing.  It appears the Crop may work will  with my setup.  I think I may get it to do most (or all) of what I need.  I have a few questions.

In the Scan Options there is an option of "Select Foreground".  I assume this will show the selection of what you are about to be crop.  Is this right?

I have not seen an Icon on the toolbars to do this.  Is there some way this can be done in the main part of the program?  I have found that increasing or decreasing the threshold with the threshold Icon at the bottom of the screen will bring up the selection box, but I need some way of getting at this by using AutoHotkey's "Send" command (sends out keystrokes to Screenshot Captor).  I suppose I could get really fancy and use AutoHotkey's Image search to find the threshold Icon and click on it but would I rather not have to do this and don't know how reliable it would be.

For the books that I do need the 1/2 inch black edge, I am thinking I can semi Automate this.  I would automatically Select the area Screenshot Captor would Crop (using a Screenshot Captor "Select Foreground" selection - if available in a menu or in some other way in the main part of the program), then I would bring up an Excel Dialog box with instructions to move the selection book 1/2 inch to the top and left and expand the box in the other direction so that there is 1/2 inch black around the whole book.  Once a the selection is moved and expanded clicking on a "Continue Button" on the Excel Dialog would instruct Excel to Close or Minimize Screenshot Captor continue to gather the rest of the Info for the Item.

Is there any way of telling Screenshot captor to move the upper corner of the threshold selection by an X,Y offset and then tell it to make the selection X,Y units bigger.  If this can somehow be done then I could completely automate the process.  If this cannot be done I would like to put it up for a future feature.  What are the chances something like this might be added?  I know the priority may be fairly low since perhaps few people would use it?

Thanks much,

Again I love Screenshot Captor

I  have been using it for quite a while with a Scanner, and now may be able to increase my speed a lot for this new Application by using the WebCam feature and automate things more as well.



mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #3 on: December 13, 2014, 03:58 PM »
Glad you like it -- I must say it really does help motivate me to continue development on the tools when I hear they are useful to people.

I think you are getting into an area where a standalone helper tool would really be the way to go.
My memory of the "Select Foreground" option is really basically the same as AutoCrop -- except that once it identifies the background it doesnt crop but it preselects the interior (foreground) rectangle that it would have cropped to.

There was an image cropping tool made my one of the members of this forum.. he might be able to add the features you need..

Relned1

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #4 on: December 14, 2014, 02:09 AM »
OK,

It would be great to have a 3rd Party App to be able to do more on cropping the image.  How do I get in touch with the member above you mentioned who has written a Crop App?

I did find a way to do something similar to what I mentioned about adding a border which I like using Screenshot captor.   After I crop the book cover,  I used the "Simple Boarder Around Image (Outside)" several times to get more some black around the image.  The book is on Black Velvet and so has a black background before I crop it.  The book is never completely perpendicular so that when I crop it, it always seems to have some black on some of the edges.  Adding some black boarder back by using the function above resolves this issue.  The book my seem just a bit rotated but I can keep this to an acceptable level.  After I add some black boarders back I use the "Deluxe Black Boarder Around Image".   I like the results I end up with.  I have attached a couple of pictures of a book I have done this too.  The first picture runs the Autohotkey script below once and the second picture runs it twice.

SetTitleMatchMode 2   
WinActivate, Screenshot Captor
WinWaitActive,Screenshot Captor, , 2

Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Enter}
Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Enter}
Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Enter}
Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Enter}
Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Enter}
Send {Alt Down}2{Alt Up}{Down}{Right}{Down}{Down}{Down}{Down}{Enter}

This may be good enough for my purpose but it might still be nice to have more options using a 3rd parties cropping program.  The only drawback to the above  is that the script above takes just a bit to run, so may add a few seconds to the picture tacking process.  I am sure a 3rd Party cropping program would be faster.

To do the above however I need to have Autohotkeys send characters to Screenshot captor telling it to "Auto Crop".  I did not see an menu Item to do this like there is for the "Auto Rotate" function.  Is there a key sequence I could use to activate this "Auto Crop" feature or is the only way to activate it would be to click on the Auto Crop Icon?


Relned1

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #5 on: December 14, 2014, 10:31 PM »
Mouser,

Never mind about the need for a way to use Autohotkeys  "Send" Command using characters or Menu items for "Auto Crop".  There appears to be something left over from  Enabling Scan that ends up selecting the foreground automatically for me (if post Scan is configured to do this).  This occurs when I do a Rotate (I always rotate 90 degrees).  I don't know why it does this but I am glad it does since I need some way of programmatically selecting the Foreground which this does.  Then I simply do a crop and I end up removing the background.

I use the Webcam exactly the same way I use a Scanner.  It is just much faster.  It would be nice if when I grab an Image from the webcam it could be set up so it would do ALL the configurations you have for post capture of Scanned Images - select foreground, rotate 90 deg, de-skew, remove background ect.

One thing I have not be able to do which would be a GREAT help if I could get it working, is to is to select the Foreground after I do a De-skew.  Is there a way to do this? Am I missing something?  It does not work for Scanned, or Webcam Images.

If I do a de-skew and then crop out the the edges that are no longer part of the Image then I believe I can get it to work.  The problem with this is so far I have not found a way to do this automatically but need to crop it manually which defeats the purpose for my application.

Thanks Much,

Relned1

  • Participant
  • Joined in 2013
  • *
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #6 on: December 14, 2014, 10:48 PM »
Mouser,

One other thing the reason the all the add a little black borders takes time is that I am going through the menu and so the display flashes as I do this slowing things down substantially.  If there was a Cntr or Alt key shortcut to do this it would go much faster since it would not need to go through the display.

I believe Autohotkeys often handles this type of thing by using a "Control Send" command instead of a "Send" command.  With the "Control Send" the Window can be minimized and every thing happens in the dark (so to speak) so it is much faster since the display is not activated with each send key menu command.  However, it appears that when one Minimizes Screen Captor it does not really go into a Minimized state but into some other Mode?  I have not gotten this approach to work with Screenshot Captor.

Do you know of a way I could get around the slow down problem above of adding incremental black to the edge of the picture many times to get a larger black boarder?  What I am using presently is workable but it does add about 2 or 3 seconds to the Image Processing Time - that is with adding 22 small black boarders.  I am sure if the Menus were not flashing - ie use a Alt or Cntr shortcut instead of sending keystrokes to the Menu Items, then doing this even 22 times would be VERY fast.

Thanks once more,


tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #7 on: December 16, 2014, 08:45 AM »
It would be great to have a 3rd Party App to be able to do more on cropping the image.  How do I get in touch with the member above you mentioned who has written a Crop App?

probably BookCrop:
https://www.donation...ex.php?topic=33201.0
Tom

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Auto Cropping Book Cover Images
« Reply #8 on: December 16, 2014, 10:09 AM »
Yep, BookCrop was what I was thinking of.