Automatic Pattern creation from Input Image

Hi all,
I've created a program to automatically create a patterns from an input image
1. The user selects image
2. with a rectangle he selects a zone of that image
3. An automatic pattern image is created as result of repeating that rectangle
It's working most of the times but sometimes:
1. The red rectangle which I use to select the area I want to repeat is not displayed
2. The area is not correctly handled and strange blank areas appear
Do you know how to solve these issues?
I put you here the whole source code so you can execute it and have fun creating patterns!
http://tlloreti.googlepages.com/src.rar
Regards
T

Part 2*
Now, about your red rectangle
class Selector extends MouseInputAdapter
    ImageSelectionPanel selectionPanel;
    Point start;
    Point end;
    boolean dragging, isClipSet;
    public Selector(ImageSelectionPanel isp)
        selectionPanel = isp;
        dragging = false;
        isClipSet = false;
    public void mousePressed(MouseEvent e)
        if(isClipSet)             // clear existing clip
            selectionPanel.setClipFrame(start, start);
            isClipSet = false;
        else                      // or start new clip
            start = e.getPoint();
            dragging = true;
            isClipSet = true;
    public void mouseReleased(MouseEvent e)
        dragging = false;
        end = e.getPoint();
        System.out.println("START="+start);
        System.out.println("END="+end);
        int width=(int) (end.getX()-start.getX()) ;
        int height=(int) (end.getY() - start.getY());
        if ((width>0)  && (height>0))
        MergeImages.GenerateFourImagesDragAndDrop(crop1.fileName, start.getX(), start.getY(),width ,height );
    public void mouseDragged(MouseEvent e)
        if(dragging)
            selectionPanel.setClipFrame(start, e.getPoint());
}The problem stems from the isClipSet and dragging variables. I have no idea what you were trying to achieve with these. I'm guessing you're making certain assumptions about the way mouse events are received that are just plain wrong. Also, the logic in the MouseReleased method is wrong. The point you define as "start" is not necessarily the top left of the clip rectangle as you have it set up. But in this call
MergeImages.GenerateFourImagesDragAndDrop(crop1.fileName, start.getX(), start.getY(),width ,height );you're assuming it is the top left point. I imagine this might contribute to your "blank areas" issue, but I'm not sure.
Change your Selector class to the code below, and the rectangle will always work (at least it does on my machine --> java 1.6.0+)
class Selector extends MouseInputAdapter
    ImageSelectionPanel selectionPanel;
    Point start;
    public Selector(ImageSelectionPanel isp)
        selectionPanel = isp;
    public void mousePressed(MouseEvent e)
        start = e.getPoint();
        selectionPanel.setClipFrame(start, start);
    public void mouseReleased(MouseEvent e)
        Point end = e.getPoint();
        end.x = Math.min(Math.max(end.x,0),selectionPanel.image.getWidth());
        end.y = Math.min(Math.max(end.y,0),selectionPanel.image.getHeight());
        selectionPanel.setClipFrame(start, end);
        System.out.println("START="+start);
        System.out.println("END="+end);
        Rectangle clip = selectionPanel.clip;
        if(clip.width > 0 && clip.height > 0)
        MergeImages.GenerateFourImagesDragAndDrop(crop1.fileName,
                                                  clip.x,clip.y,
                                                  clip.width,clip.height );
    public void mouseDragged(MouseEvent e)
        selectionPanel.setClipFrame(start, e.getPoint());
}You will see that a new problem surfaces. That problem is that generated patterns affect previous ones. I imagine this has to do with your extensive use of static variables. Any swing person will tell you that a static GUI component constitutes as a bad idea in the majority of situations. But I'll let you deal with that.

Similar Messages

  • Automatic PO creation from SC

    Hi Experts,
    I am using SRM 7.0 with extended classic scenario and I have issue in the automatic po creation. For some Shopping Carts the PO is not automatically created. The SC is having Source of Supply Assigned and all the approves have completely approved the SC.  The latest status is  I1111          Item in Transfer Process.
    I checked in RZ20, ST22 and could not find any error or dumps.
    For the SC item under BBP_PDBEI the BE_OBJECT_TYPE is BUS2201 and BE_OBJECT_ID 1, once I trigger the PO creation manually the PO object id is reflected here.
    For such SC I am running the report BBP_ALERT_SB_NOTTRANSFERED manually which puts the SC in I1112 Error in Transmission Status and later I can trigger the SC creation from the alert monitor.
    For POs created in this manner the PO is created in Held Status without any line items, is this normal?
    I have two questions which I want to understand, how is the automatic po creation from SC setup, is there any customizing involved for the po creation from SC to happen automatically?
    What else should I check to find the reason why the the SC was stuck in I1111 status and PO was not created?

    You need to configure the Purchasing group and this will take care of automatic transfer of Doc to sourcing cockpit. Make sure you also maintain the customization for sourcing always carried out for Prod categories.
    Regards
    Saurabh

  • While automatic PO creation from GR conditions to be fetched from condition

    Hi SAP Gurus, i have a requirement where in I want PO to be automatically created while doing GR.All other settings I have done. Now my requirement is tat say freight conditon FRC1 should be picked up from condition record.I already have condition record maintained.please let me know if this is possible or is it like that for automatic PO creation from GR info record is mandatory.Please let me know.Thanks

    Hi,
    Condition record will not help for the automatic PO creation from GR. Use Info record and maintain your conditions like discount, freight,packng and forwarding etc.....

  • Automatic PO creation from Imported Approved Requisition

    Hi,
    Is there any setup to allow automatic PO creation from Imported Approved Requisition.
    1. Run Requisition Import to import approved Requisition with no workflow fired.
    2. Can we kick off automatic PO creation workflow without kicking off Requisition approval workflow?
    Any suggestion will be helpful.

    Hi,
    pl.review the MOS doc.
    How to Create and Approve a Standard PO Automatically From an Approved Requisition Sourced to Standard Quotations [ID 308470.1]
    HTH
    Sanjay

  • Automatic PO creation from PR for non materials

    A requirement has recently been raised where the business wants to introduce the use of purchase requisitions and once the purchase requisiiton has been released (approved) a purchase order be automatically created from the purchase requisition. However the business do not use or maintain material records, purchasing info records or source lists. If the the standard automatic purchase order from purchase requisition is used (ME59N) these items are required. In entereing the purchase requisition it is expected that the 'Desired Vendor' will be entered. Has anyone had a similar scenario where the automation of purchase order creation is required? Any assistance is appreciated.
    Thanks

    Hi,
    For no material, only for SERVICE procurement , the Service auto- PO created by activating Automatic Purchase order creation for Service requisitions in t.code: ML91. Create info record based on Material Group. For Automatic PO , info record is mandatory. For more please read note 635511
    Regards,
    Biju K

  • Automatic PO creation from PR with no master data

    Dear gurus,
    Is it possible to run ME59- Auto PO creation from approved PR with no master data/source assigned/PIR? Assuming user create adhoc PR.
    Is it possible to run this process successfully if i didn't meet on the criteria below? let say no.1 is not checked?
    1.Material Master purchasing view, check automatic PO check box.
    2. Vendor Master purchasing view, check automatic PO check box.
    3. Maintain Source list for Vendor and Material (transaction ME01) and also see validity period.
    4. Maintain Purchase Info Record (transaction ME11), check info record category (must be standard or pipeline or subcontracting)
    5. Create a Purchase Requisition ( transaction ME51N), during creation select check box of Source Determination.
    6. Use transaction ME59 and execute for purchase requisition for vendor, you will be able to create automatic PO.
    Thanks in advance.

    Hi,
    yes all point should be checked
    check following link
    [http://www.sap-img.com/materials/steps-to-create-auto-po.htm]
    Regards
    Kailas Ugale

  • Create Pattern Swatch from Placed Image in Javascript

    I need to create a large number of pattern swatches from some .jpg file on disk. I've figured out how to script the insertion of the .jpgs into my AI document as placed images:
         // Embed the image into the document.
         file = new File("MyImage.jpg");
         var document = app.activeDocument;
         var newPlaced = document.layers["swatches"].groupItems.createFromFile(file);
         newPlaced.name = "MyImage_Placed";
    This works fine and the item shows up in the correct layer as an embedded image.
    Now I want to create a PatternSwatch (I think) from that Image.
    To create a new swatch the code starts out as:
         newSwatch = document.swatches.add();
         newSwatch.name = "MyImage_Swatch";
    but now I'm stuck! How do I associate the new PlacedItem with the swatch I just created? I can see the swatch in the palette so I'm partway there.

    When you say you would drag the image itself into the Swatch Palette and it would show the image itself? How would then use this swatch? Can you give an example of what you would apply a jpeg to as a swatch? The only palette that I can think of off the top of my head that you can drag a jpeg into and have the icon appear as the jpeg is the Symbols Palette. Is is possible that you were using the Symbols Palette in the past and not the Swatch Palette?

  • Movie Creation from an Image Sequence

    Hi, my question is about how to use iMovie to create a movie from an image sequence.
    I have much experience doing this in Quicktime Pro. I just import the image sequence and select the time interval for each frame.
    I want to use iMovie 4 nstead of Quicktime Pro to do this because I'd like the frames to span variable time lengths and be synced to audio. I'm sure this is easy, but as someone new to iMovie I have no idea how to do it.
    thanks
    Powerbook G4 15 aluminum   Mac OS X (10.4.7)  

    Another way is to import the sequence directly into iMovie, automatically importing with the duration you want. iMovie lets you set a duration from 1 frame up.
    • iMovie lets you select any number of images to import at the same time, so you can select one image to import or a sequence of images in a folder. (Use the Import command so the numbered sequence arrives in the proper order.)
    (To import all the images in a folder, press Command-A after navigating to that folder. Otherwise use Command-clicking and Shift-clicking to select the images.)
    • Imported images always conform to your current Ken Burns settings. So if KB is set to import as 5 seconds with no zoom, that's how the images arrive.
    But you're not limited to <n> seconds. You can force KB to import as 1 frame, 10 frames or whatever. The trick is to first configure KB to import with that duration.
    Trouble is, the KB duration textbox is buggy so you can't type your desired duration there. But KB can be set another way, by clicking on any previously-imported image. So the trick is to create a clip with the duration you want, then use it as a "template" for importing other images.
    To create a clip with the duration you want, double-click on a previously-imported clip and set its duration to <n> frames. (Type 00:00:01 for one frame.) Before importing the sequence, click on that clip, which sets KB to apply its settings for the next import(s).
    One can create a series of "template" clips, one for each duration commonly used. Before importing each new set of images, click on the clip you want to control the next import.
    Unfortunately, once images are imported there is no way to simultaneously Update all to a new duration using a textbox. It may be easiest to simply re-import the images with a new duration.
    Karl

  • Automatic PR Creation from Sales order

    Hi All,
              This is with respect to PR creation from Sales order for 3rd party items.
    I am able to create PR from standard sales order and i dont have any issues with that.  I have used schedule line categories which is configured with Order type Z2, Item rel for dlvy checked and Acct assigment group as E.
    Now my question is , I want to copy partners from sales order to Purchas req. Currently some partners are getting transferred from Sales order to P.Req, But not all there in sales order. Where do we control the data that can be copied from Sales order to P. Req
    Thank you
    Kris

    Hi,
    Genrating PR, Mostely depends on shedule line,see which shedule line u r determining for HIGH LEVEL ITEM ,for that shedule line maintain setting is VOV6.
    kapil

  • Automatic PO creation from PRs?

    Hi,
    I got to generate automatic purchase orders from purchase requisitions.
    A stdd Transaction ME59N is already availablefor this, but I need to create POs without GR. This is a requirement in IS Media module.
    We can approach in 2ways: 1. copy the stdd and modify
                                              2.create a Z prog from scratch
    Please help me if you have worked on a similar requirement.
    with regards,
    Ravi
    points will be given

    Hi,
    I believe you can setup this in the configuration not to do GR..
    You can check the purchasing document type config or purchasing item category configuration..
    Also check with your MM functional consultant to achieve this..
    Thanks
    Naren

  • Linked Images : Automatic Folder Creation for linked images?

    Best Rgards
    Mac OSX 10.9.3
    InDesign CC (9.2.1)
    Presently: 120 page Blurb publishing with 190 images
    I have created a large number of INDD documents that I piece together from many sources,
    such as file folders, internet searches, external drives, emails...kind of grabbing things
    from all over the place. usually I publish this as a PDF for local and archival use. Sometimes
    using this also for newsletters and other ways to distribute documents as pdf and epub.
    I never really paid to much attention to LINKED FILES and where they might
    be located, as my intent was PDF and you can publish a very
    serviceable Pdf without verifying or correcting MISSING LINKS...
    NOW, I am working on a higher end 120 page Photo BOOK to have printed on paper.
    I did not organise my image assets into a folder, i should have first. Now as I go to
    upload to the publisher I find I have to many missing links to images. So I am going
    back through the whole project and organising the assets and re-linking...what a lot of work this is.
    I was wondering if InDesign supports automatic creation of assets folder?
    As you place images, with their links, the program creates a folder and puts a copy of the file there?
    I don't see anything about this subject.
    I am wondering why not? It would sure make the work flow speed up. Options for
    the format, size, pip etc. Does this exist in InDesign and if not
    wtf not?
    Sure would appreciate anyone's thoughts on this. It is to late now to save this
    relinking 190 images, but I realise I need to be better prepared with my assets in the
    future. I work on a number of publications, some spontaneously and others
    more carefully planned...some sort of auto process for asset-linked-folders
    seems a simple enough coding issue. It is 2014 already.
    ???....best rgards, Thanks for any input on this issue.
    WF Posey
    Pantelleria Italy

    Thanks to everyone for these answers. I guess the real answer is "no", Adobe software engineers see no reason to create a script which
    will place linked files into a folder. To bad. A really serious and lazy oversight in my view. The package function is helpful if one has already
    organised their assetts.
    As great as these programs are, this is an oversight of some frustration. As I said in my comments above, it seems an easy enough routine to program
    into the app. Why should a user have to worry about collecting details of resources/links for a document?
    Even after all these years?
    Best regards, thanks to everyone who contributed some thoughts.
    WFP

  • Automatic PO creation from PR ME59N

    HI,
    We are creating PO's after the PR is duly approved as per the relaese strategy.
    Can we use automatic creation functionality to reduce the manula inputs and errors.
    regards,
    ab

    Hi,
    Yes you can create Automatic PO from PR Via ME59N.
    but for this you have to check Automatic PO in both purchasing View of Material Master and Vender master .
    also maintian Purchse Info Record with T code ME11 for value and tax code and
    source of Supply in ME01 and assign source of Suppy in PR and release  PR and
    go to ME59N to create automatic PO with that PR.
    But remember that you can not put additional Conditions in PO for E.g. ur fright charges and Packaging and forwarding charges via automatic PO.
    Regards,
    Pardeep Malik

  • Update VEKP-EXIDV2 during automatic HU creation from outbound delivery

    Hi All,
    I need your suggestion / input on following scenario.
    When I create an outbound delivery and save it, an automatic Transfer Order is created and at the same time an HU is created for delivery.
    Now, I want to populate the field VEKP-EXIDV2 ( HU header -- Handling Unit's 2nd External Identification) with a specific logic.
    Can anyone suggest a suitable EXIT or BADI or Enhancement point where I can populate the field VEKP-EXIDV2 ?
    Note: I have tried using EXIT_SAPLV51S_001 and also BADI_HU_MAIN, but it is not helping in my case.
    Because it is called only when Transfer Order is created manually (LT03), but is not triggered when TO is created automatically after saving the outbound delivery.
    Thanks & Regards,
    Devendra

    Hi Ankur,
    I am not going into HU creation screen in VL02N. There is some setting on functional side to create the automatic TO and HU during outbound delivery creation.
    When I save the delivery, an entry in HU header table (VEKP) gets created automatically. I want to populate the field VEKP-EXIDV2. But, the EXIT or BADI as mentioned in my previous post is not helping in this case.
    I would appreciate if you can throw some light in resolving this problem.
    Thanks.
    Devendra

  • Automatic project creation from Sales Document

    Hi Experts,
    Could you please advise what are the steps needed to obtain automatic creation of project from Sales Inquiry?
    Thank you in advance!!
    Aleksandra

    Hi,
    1. Create standard WBS CJ91
    2.create standard Network CN01
    3.Assign material (Finished) to standard network CN08.
    SD Config:
    1. Create sales document type.
    2. Check requirement classes and requirement types take KMPN and 212
    Material Master Settings:
    3. For material in MM02 material master ,
    4.Maintain view MRP3 Strategy group 85 Assembly processing with network/project.
    Create Sales order:
    Assign material to sales order and while saving it will trigger project.
    Muzamil

  • Newbie: How to automate link creation from a map index grid?

    We would like the user to jump to an atlas page from the index page (similar to table of contents in a book). There are more than 135 pages in the map atlas. we would like to automate the link creation.

    It might be possible to do this with a script, but it depends very much how the file was created and what the contents of it are.
    If you wish, you can send me the file to try6767 at gmail dot com and I'll have a look at it.

Maybe you are looking for