How to auto-crop empty area (white space) from a scanned image

I have a image scan operation thru' which the user can scan a A4-size paper, but the actual data on the scanned image is a small area.
Any way that we can programatically crop the white area from the scanned image?
Does JAI have any apis for doing this ?

If you look at the constructor for BufferedImage, you can create an image of a size you specify. After creating the image, you can draw on it by obtaining its Graphics via the createGraphics() method. Now, you can draw the source image on the target image using something like
imageGraphics.drawImage(sourceImage, 0, 0, targetImage.getWidth(), targetImage,getHeight, sourceUpperLeftX, sourceUpperLeftY, sourceUpperLeftX + targetImage.getWidth(), sourceUpperLeftY + targetImage.getHeight(), observer);
now, your BufferedImage has the cropped image on it. Dispose of the graphics (good habit to release resources it used) and you are done.

Similar Messages

  • How can I remove the rectangular white space behind the extracted image

    How can I remove the rectangular white or chequered space behind the image after i have extracted it from a photo, then save it as a separate image?
    Any easy steps advice would be good1
    Thanks

    Hello Josh:
    Short answer - I do not know of any Safari setting. I suppose you could save the page as a PDF file and play with it there.
    Barry

  • How do I remove the white space from the bottom and side of my document?

    How do I remove the white space from the bottom and side of my document? (I'm not talking about printing, just viewing it on the screen.) There are about 6 inches of white space at the bottom and at the right hand side. I don't like this. On a blank new spreadsheet it's triple that amount of white space.

    The infinite canvas convention doesn't make a lot of sense for Numbers. When I'm viewing a spreadsheet and mistakenly scroll into white, empty space I think, "this is ridiculous - all of my content is fits on one screen. there's nothing over there."
    A (relatively) infinite canvas is logical for Microsft Excel because it's one big table. There are 256(?) columns by default and hundreds of rows on a sheet - there are cells outside what a user is looking at to see. However, when viewing a Numbers spreadsheet with a single 10 column 10 row table that fits on the screen, there's nothing else on it to scroll to.
    Numbers should distinguish between viewing a spreadsheet and editing one. When I'm just viewing, when there's no content outside the window it shouldn't scroll there. This window behavior is beyond annoying for Numbers on my iPad and iPhone.
    (Adding user-defined canvas size setting to my view mode / edit mode thinking would probably be the most complete solution to this now that I think about it.)
    Until now the way scrolling worked in Numbers has defied logic. Actually it still does lol. That said, thank you Yellowbox for providing a clear explanation. Much appreciated.

  • Is it possible to exclude white space from creating records using UNPIVOT

    SELECT
            FROM
                Table1
                UNPIVOT EXCLUDE NULLS
                    NEW_COLUMN
                    FOR COLUMN_NAME IN
                       FIELD1, field2, --------------FIELD20
                )I don't want to create row for whitespace (empty value) in any of field1-field20 columns. Row should create for each of value present in any of FIELD1-FIELD20. Is it possible to exclude white space from creating records using UNPIVOT? I am just looking for syntax if there any. thanks

    Hi,
    Sorry, it's very unclear what you want.
    Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    Have you tried the the UNPIVOT EXCLUDE NULLS option? See the SQL Language manual for details.
    It that doesn't do what you want, then you may need to UNPIVOT in a sub-query, generating more rows than you want, and use a WHERE clause in the main query to remove the unwanted rows.

  • How can one remove a raised texture pattern from a scan of the original photo?

    How can one remove a raised texture pattern from a scan of the original photo?
    Have several wedding photos scanned into PS Elements that were printed by the pro, photography studio on a raised pattern paper. Would anyone know how to remove the honey comb type pattern so that the picture canbe printed flat on glossy color photo paper?
    Any help would be greatfully appriciated.
    Thanks,

    The best way to remove a pattern is to use a Fast Fourier Transform.  There's a free plugin (as well as examples and instructions) here:
    http://dl.dropboxusercontent.com/u/6795661/4N6site/improc/fftplugin/examples.htm
    Using the plugin requires editing the individual colour channels, which PSE does not natively allow.  You'll need the reasonably-priced Elements+ addin:
    http://elementsplus.net/
    Here's a crop at 100% of the result I got:
    The pattern is much reduced.  With some experimenting, you can probably do a little better.
    Ken

  • How do you get rid of white space when you are printing multiple pages to one sheet of paper?

    How do you get rid of extra white space when you are printing multiple pages to one sheet of paper?  When printing multiple pages to one sheet of paper Acrobat won't let you select the "zoom" for printing.
    Thanks

    Take a look at Quite Imposing.

  • How to get rid of a white space?

    I have cfscript codes that look like the following:
    <CFSCRIPT>
    if (listFind("2,3,4,5,6",getEmp.EMPID))
    varPAEN = "";
    if (listFind("5,6,7", A_New[13]))
    varLangEN = "If you are not a member of this forum, please
    register";
    if (listFind("2,3,6",getEmp.EMPID))
    These online forums are for user-to-user discussions of
    Adobe products, and are not an official customer support
    #varLangEN#. If you require direct assistance on our
    products please call 1-800- etc....
    </CFSCRIPT>
    The problem I have is when the variable varLangENG is empty,
    it creates an extra white space within the sentence. So instead
    user seeing :
    "These online forums are for user-to-user discussions of
    Adobe products, and are not an official customer support .
    If you require direct assistance on our products please call
    1-800- etc...."
    They see and extra white space before the period:
    "These online forums are for user-to-user discussions of
    Adobe products, and are not an official customer support . <<
    If you require direct assistance on our products please call
    1-800- etc...."
    This is not the only sentence affected. Please help if there
    is a solution. Thanks!

    Thinking outside of the box, or space as the case may be.
    Move the
    leading space character into the variable definition. Then if
    the
    variable is empty there is no space before it.
    varLangEN = " If you are not a member of this forum, please
    register";
    support#varLangEN#.

  • How to remove white spaces from XML content using Coldfusion?

    Hi,
    Can anybody help me in removing white spaces in between the tags from the below XML content using coldfusion?
    XML content:
    <?xml version="1.0" encoding="UTF-8"?> <chart showdates="true" today="08/12/2009"> <phases> <phase color="CCFFCC" name="Funded"/> <phase color="CDCD67" name="Concept"/> <phase color="99CCFF" name="Feasibility"/> <phase color="0099FF" name="Development"/> <phase color="0099FF" name="Development"/> <phase color="CC99FF" name="Close-out"/> <phase color="909090" name="Sustaining"/> </phases><program name=""> <project enddate=" 30/03/2007 " id="43250" startdate=" 28/02/2006 "> <version enddate=" 30/03/2007 " number=" 1" startdate=" 28/02/2006 "> <phase color="CCFFCC" currentdate="23/03/2006" name="Project Start" plandate="28/02/2006" type="phase"/> <phase color="99CCFF" currentdate="04/04/2006" name="Feasibility Closure" plandate="31/05/2006" type="phase"/> <phase color="0099FF" currentdate="29/03/2007" name="Commercialization" plandate="30/12/2006" type="phase"/> <phase color="CC99FF" currentdate="30/03/2007" name="Project Closed" plandate="30/03/2007" type="phase"/> <phase color="909090" currentdate="" name="Obsolescence" plandate="" type="phase"/> </version> </project> </program> </chart>
    Output I am expecting is like below,
    <?xml version="1.0" encoding="UTF-8"?><chart showdates="true" today="08/12/2009"><phases><phase color="CCFFCC" name="Funded"/><phase color="CDCD67" name="Concept"/><phase color="99CCFF" name="Feasibility"/><phase color="0099FF" name="Development"/><phase color="0099FF" name="Development"/><phase color="CC99FF" name="Close-out"/><phase color="909090" name="Sustaining"/></phases><program name=""><project enddate=" 30/03/2007 " id="43250" startdate=" 28/02/2006 "><version enddate=" 30/03/2007 " number=" 1" startdate=" 28/02/2006 "><phase color="CCFFCC" currentdate="23/03/2006" name="Project Start" plandate="28/02/2006" type="phase"/><phase color="99CCFF" currentdate="04/04/2006" name="Feasibility Closure" plandate="31/05/2006" type="phase"/><phase color="0099FF" currentdate="29/03/2007" name="Commercialization" plandate="30/12/2006" type="phase"/><phase color="CC99FF" currentdate="30/03/2007" name="Project Closed" plandate="30/03/2007" type="phase"/><phase color="909090" currentdate="" name="Obsolescence" plandate="" type="phase"/></version> </project></program></chart>
    Thanks in advance,
    Regards,
    Manoz.

    Daverms,
    Thanks for the quick turn around..
    I have applied the solution what you suggested above (<cfprocessingdrirective suppresswhitespaces="yes"), still whitespaces are existing in my output.
    The output what I am getting is,
    (blue color part is my output & red color indicates whitespaces)
    <?xml version="1.0" encoding="UTF-8"?>
    <chart showdates="true" today="09/12/2009">
    <phases>
    <phase color="CCFFCC" name="Funded"/>
    <phase color="CDCD67" name="Concept"/>
    <phase color="99CCFF" name="Feasibility"/>
    <phase color="0099FF" name="Development"/>
    <phase color="0099FF" name="Development"/>
    <phase color="CC99FF" name="Close-out"/>
    <phase color="909090" name="Sustaining"/>
    </phases>
    <program name="">
    <project enddate=" 01/01/2010 " id="12059" startdate=" 20/06/2003 ">
    <version enddate=" 01/01/2010 " number=" 1" startdate=" 20/06/2003 ">
            <phase color="CCFFCC" currentdate="20/06/2003" name="Project Start" plandate="20/06/2003" type="phase"/>
            <phase color="CDCD67" currentdate="" name="Concept Closure" plandate="" type="phase"/>
            <phase color="99CCFF" currentdate="20/06/2003" name="Feasibility Closure" plandate="20/06/2003" type="phase"/>
            <phase color="F0FF00" currentdate="" name="Alpha Test" plandate="" type="milestone"/>
            <phase color="F0FF00" currentdate="26/07/2004" name="Beta Test" plandate="31/05/2004" type="milestone"/>
            <phase color="0099FF" currentdate="29/06/2005" name="Commercialization" plandate="08/12/2004" type="phase"/>
            <phase color="CC99FF" currentdate="24/02/2006" name="Project Closed" plandate="01/01/2010" type="phase"/>
            </version>
    <subproject enddate=" 16/10/2008 " id="11809" name="espWatcher Pricing Toolkit" startdate=" 01/08/2003 ">
    <version enddate=" 16/10/2008 " number=" 1" startdate=" 01/08/2003 ">
            <phase color="CCFFCC" currentdate="01/08/2003" name="Project Start" plandate="01/08/2003" type="phase"/>
            <phase color="99CCFF" currentdate="" name="Feasibility Closure" plandate="" type="phase"/>
            <phase color="0099FF" currentdate="15/06/2005" name="Commercialization" plandate="08/12/2004" type="phase"/>
            <phase color="CC99FF" currentdate="16/10/2008" name="Project Closed" plandate="16/10/2008" type="phase"/>
            </version>
    </subproject>
    <subproject enddate=" 31/12/2070 " id="35704" name="espWatcher version 2 (2005)" startdate=" 01/01/2005 ">
    <version enddate=" 31/12/2070 " number=" 1" startdate=" 01/01/2005 ">
            <phase color="CCFFCC" currentdate="01/01/2005" name="Project Start" plandate="01/01/2005" type="phase"/>
            <phase color="99CCFF" currentdate="01/07/2005" name="Feasibility Closure" plandate="01/07/2005" type="phase"/>
            <phase color="0099FF" currentdate="31/03/2006" name="Commercialization" plandate="31/03/2006" type="phase"/>
            <phase color="CC99FF" currentdate="31/12/2070" name="Project Closed" plandate="31/12/2070" type="phase"/>
            </version>
    </subproject>
    </project>
    </program>
    </chart>
    However this solution removes most of the whitespaces, I want exact output as flash file is expecting so..
    Where ever I am calling the CF functions, there I am getting the whitespaces. like below cases.
    startdate="#getProjectStartDate(sProjectIdList)#" -> output I am getting for this statement is -> " 12/09/2009 "
    Please assist me...
    Regards,
    Manoz.

  • How do I get rid of white space on one side of image in table cell?

    I'm making a disjointed rollover and when ever I add images it creates too much white space to the right of the cell.  How can I make the picture fit, so space is not wasted?  See image sample with red arrows where I want to remove space.  I've removed the width size from my table, hoping it would "spring to shape" around the images, but no go.

    HTML:
    Cellpadding="0"
    Cellspacing="0"
    CSS:
    table {border-collapse: collapse}
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • How to Auto Populate Business Area in MIRO

    Hi Gurus,
    I am working on a issue of business area not being auto populated in MIRO transaction. Can anyone please help me out with how to make the business area populate in there.
    I have already checked that business area is set as a mandatoty field in this transaction and linked with Plant (OMJ1). Also the cost centers also have the business area defined at the master data level.
    I really appreciate the quick response
    Regards

    Hi,
    Entries happen in background like tax you are not able to get the business area(if you are using new general ledger you can get just check once)
    for other entries line items like vendor you can give the business area in MIRO header.
    After you posted the document check the gl account balance respective business area wise in FAGLB03.
    Regards,
    Sankar

  • How to extract ALL text on a line, including extra white space, from PDF?

    I have written my first scripts to parse thru PDF files and successfully locate the beginning and ending of text portions that I wish to copy/extract.  For example, one of the scripts reads thru PDF files and locates patterns that allow me to copy/extract a lengthy Title that spans several lines on the page.  My remaining problem is that sometimes the text I wish to copy/extract has tabs or lots of white space between the words, and I need to retain ALL the "white space" between words.  Basically, I am successful at using getPageNthWord(j, i, false) along with "Quad coordinate sets" to get a word-at-a-time for all the words on the multiple lines but it seems to be skipping over the tabs and extra white spacing beetween the words.   Another way to say this is that I need to extract/copy a full line at a time, including all white space, instead of being limited to just a word at a time. 
    Can anyone help me with an algorithm to extract/copy text, not just the words but also including tabs and other extra white space characters? Is there some type of Regular Expression I should be using, or maybe some additional parameter used for getPageNthWord that would retain all the extra white space?
    Thanks in advance,
    Ted L

    Did you try setting the bStrip parameter of getPageNthWord to false? It will
    preserve some of the whitespace, but not all of it.
    As far as I know, that's the only way to do it via a script.

  • Remove extra white space from an image

    I want to remove the extra white space in my image while writing it into a jpeg file using JPEGImageEncoder.
    Any help is welcome .

    ok.. Am having a JPanel whose width is set to 77000. But almost 60% of right hand side of the Panel is empty. I will create a BufferedImage from this component and then write it into a file using JPEGImageEncoder.
    The empty portion of the panel is coming as a white space in the image.
    Now how to remove this ? Was that clear enough ?

  • White spaces before and after Images

    I have several images in my FM document,
    They are either gif or jpg.
    All set in Anchored frames, left-aligned.
    I have made most of them conditional for Online help, so they
    dont show up in my Online help.
    My issue is I am not sure how to remove all the space that
    appears before and after the images (they are not displayed because
    I have set it to conditional)
    I remember somewhere that the spaces for such images can be
    removed.
    Please let me know if there is.

    Hi,
    Thanks for replying.
    I have removed the spaces before and after the images in
    Frame.
    Set the images to be conditional (only for print). If there
    are any images they are in anchored frame--left aligned.
    So my problem is that the space before - after and the place
    where the image originally was (now not displayed as it is
    conditional) have these huge white spaces displayed.
    I am not sure how to map them or how to delete them.
    I am familiar in FM, and Robohelp (although i have worked
    with Word only and it was easy). For some reason this seems too
    hard.
    Hope I have gotten across to you with my question.

  • Extra White Space from Hidden Menu Bar

    This seems to be a problem introduced by LV 2013. I have a VI that runs with the menu bar hidden. When I hit ctrl-m to see how it looks in run mode, it looks fine. When I run the VI, instead of fully hiding the menu bar, it leaves white space. This only seems to be a problem when the VI is the top level. When the VI is opened from another VI, it looks fine. I've attached screenshots when the VI is running as a top level, ctrl-m is used and running when launched from another VI. This was not an issue in LV 2012. It's only been a problem since switching to 2013.
    Solved!
    Go to Solution.
    Attachments:
    Settings Screen Running Dev.png ‏86 KB
    Settings Screen CTRL-m.png ‏84 KB
    Setting Screen - Launch as SubVI.PNG ‏107 KB

    Greetings thutch79,
    I replicated the settings shown at Window Appearance Dialog.png on a new VI, ran it, and did not reproduce the problem.
    I wonder if you experience the same behavior with a new VI? If not, you can copy paste the code to a new VI to fix a potential corruption issue.
    Regards,
    Alejandro | Academic Program Engineer | National Instruments
    Attachments:
    Window Appearance.JPG ‏119 KB
    Running VI.JPG ‏21 KB

  • How to remove the extra or blank space from RTF Template

    Hi All,
    Try to remove the extra space from  xml template.
    Here I have attached the .xml file with .rdf, here the issue is when you load the data we will get 2 page output but when I am trying to add any column or extra space in the last page of this template the output getting 4 pages with lot of blank space. Could you please guide me to solve this issue.
    Could you please let me know how to do the attachement in this forum as I am new to this community.
    Regards,
    Sushant

    Can you drop in a mail with RTF, xml data to [email protected], I will help you on the issue.

Maybe you are looking for

  • Logged into temporary profile how do i get back to my regular profile?

    WHen I log into my desktop PC it takes for ever to get to the start page. It says it is preparing windows. After finally getting past this page it does one of two things. 1. It goes to a all blue screen, When it does this I have to shut my computer o

  • Can't import .jpg's from a CD into iPhoto 8

    My friend asked me to help her create a slideshow out of 434 jpeg photos she gave me on a CD. When I try to import them, iPhoto 8 accepts only 88 of them. I get the following error message: Unreadable Files 210 The following files could not be import

  • Skype Unlimited World Subscription Payment Refused

    If you have failed to pay due to credit card expiry or any other reason and once Skype has tried to charge you and they fail and cancel your subscription - you can't do anything to renew your subscription - or can you? I have wasted three days and um

  • Last hope..please help me

    Recently i brought my ipod mini of off my sister for $100 bucks.. and about a month after she gave it to me.. its decided not to work. now im a little peed off. I was listening to it..and the battery went dead. then... it would not turn on. i left it

  • Parts of timeline render out, the whole timeline wont..!

    I am trying to export my 90min-long timeline, tried with Premiere, tried with AME, CUDA on and CUDA off, but no luck - it kept failing, sometimes minutes into the render, sometimes hours, sometimes moments before finishing.  As a troubleshooting atte