Re: How to Join two images

Do you want to side by side the images so one is on the left and the other on the right? If so just make them the appropriate size and copy them to the correct locations.
If you want to overlay on onto the other then xor them.

i have tried following code but it gives me image of 2 strips
public static void joinImage()throws Exception{
          //loads two images with ImageIO
          //for testing purpose both header and content image are same
          BufferedImage imageHeader=ImageIO.read(new File("/home/g.pol/images/DSC04249.JPG"));
          System.out.println(""+imageHeader.getHeight()+" "+imageHeader.getWidth());
     BufferedImage imageContent=ImageIO.read(new File("/home/g.pol/images/DSC04249.JPG"));
     //create new BufferedImage instance of same width and height as that of merging images
     BufferedImage resultantImage=new BufferedImage(imageHeader.getWidth(),imageHeader.getHeight()*2,BufferedImage.TYPE_INT_ARGB);
     //get graphichs of resultant image
     Graphics resultantGraphics=resultantImage.getGraphics();
     //draw image on graphics with width is same as that of test images but height 1/2 of test image
     resultantGraphics.drawImage(imageHeader,0,0,null);
     resultantGraphics.drawImage(imageContent,0,50,null);
     ImageIO.write(resultantImage,"jpg",new File("/home/g.pol/images/result.JPG"));
     System.out.println("success");
     }

Similar Messages

  • How to join two internal table rows in alternative manner into one internal table?

    How to join two internal table rows in alternative manner into one internal table?
    two internal tables are suppose itab1 &  itab2 & its data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    d
    e
    f
    g
    h
    i
    Header 1
    Header 2
    Header 3
    1
    2
    3
    4
    5
    6
    7
    8
    9
    INTO itab3 data
    Header 1
    Header 2
    Header 3
    a
    b
    c
    1
    2
    3
    d
    e
    f
    4
    5
    6
    g
    h
    i
    7
    8
    9

    Hi Soubhik,
    I have added two additional columns for each internal table.
    Table_Count - It represents the Internal Table Number(ITAB1 -> 1, ITAB2 -> 2)
    Row_Count  - It represents the Row Count Number, increase the row count value 1 by one..
    ITAB1:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    a
    b
    c
    1
    1
    d
    e
    f
    1
    2
    g
    h
    i
    1
    3
    ITAB2:
    Header 1
    Header 2
    Header 3
    Table_Count
    Row_Count
    1
    2
    3
    2
    1
    4
    5
    6
    2
    2
    7
    8
    9
    2
    3
    Create the Final Internal table as same as the ITAB1/ITAB2 structure.
    "Data Declarations
    DATA: IT_FINAL LIKE TABLE OF ITAB1.          "Final Internal Table
    FIELD-SYMBOLS: <FS_TAB1> TYPE TY_TAB1,     "TAB1
                                   <FS_TAB2> TYPE TY_TAB2.     "TAB2
    "Assign the values for the additional two column for ITAB1
    LOOP AT ITAB1 ASSIGNING <FS_TAB1>.
         <FS_TAB1>-TABLE_COUNT = 1.             "Table value same for all row
         <FS_TAB1>-ROW_COUNT = SY-TABIX. "Index value
    ENDLOOP.
    "Assign the values for the additional two column for ITAB2
    LOOP AT ITAB2 ASSIGNING <FS_TAB2>.    
         <FS_TAB2>-TABLE_COUNT = 2.                  "Table value same for all row
         <FS_TAB2>-ROW_COUNT = SY-TABIX.      "Index value
    ENDLOOP.
    "Copy the First Internal Table 'ITAB1' to Final Table
    IT_FINAL[] = ITAB1[].
    "Copy the Second Internal Table 'ITAB2' to Final Table
    APPEND IT
    LOOP AT ITAB2 INTO WA_TAB2.
    APPEND WA_TAB2 TO IT_FINAL.
    ENDLOOP.
    "Sort the Internal Table based on TABLE_COUNT & ROW_COUNT
    SORT IT_FINAL BY  ROW_COUNT TABLE_COUNT.
    After sorting, check the output for IT_FINAL Table, you can find the required output as shown above.
    Regards
    Rajkumar Narasimman

  • How to join two tables

    hi
    how to join two tables using inner join  if the first table has two primary keys and second table has 3 primary keys

    Would describe type of joins in ABAP, which might differ with other joins.
    The join syntax represents a recursively nestable join expression. A join expression consists of a left-hand and a right- hand side, which are joined either by means of INNER JOIN or LEFT OUTER JOIN. Depending on the type of join, a join expression can be either an inner (INNER) or an outer (LEFT OUTER) join. Every join expression can be enclosed in round brackets. If a join expression is used, the SELECT command circumvents SAP buffering.
    On the left-hand side, either a single database table, a view dbtab_left, or a join expression join can be specified. On the right-hand side, a single database table or a view dbtab_right as well as join conditions join_cond can be specified after ON. In this way, a maximum of 24 join expressions that join 25 database tables or views with each other can be specified after FROM.
    AS can be used to specify an alternative table name tabalias for each of the specified database table names or for every view. A database table or a view can occur multiple times within a join expression and, in this case, have various alternative names.
    The syntax of the join conditions join_cond is the same as that of the sql_cond conditions after the addition WHERE, with the following differences:
    At least one comparison must be specified after ON.
    Individual comparisons may be joined using AND only.
    All comparisons must contain a column in the database table or the view dbtab_right on the right-hand side as an operand.
    The following additions not be used: NOT, LIKE, IN.
    No sub-queries may be used.
    For outer joins, only equality comparisons (=, EQ) are possible.
    If an outer join occurs after FROM, the join condition of every join expression must contain at least one comparison between columns on the left-hand and the right-hand side.
    In outer joins, all comparisons that contain columns as operands in the database table or the view dbtab_right on the right-hand side must be specified in the corresponding join condition. In the WHERE condition of the same SELECT command, these columns are not allowed as operands.
    Resulting set for inner join
    The inner join joins the columns of every selected line on the left- hand side with the columns of all lines on the right-hand side that jointly fulfil the join_cond condition. A line in the resulting set is created for every such line on the right-hand side. The content of the column on the left-hand side may be duplicated in this case. If none of the lines on the right-hand side fulfils the join_cond condition, no line is created in the resulting set.
    Resulting set for outer join
    The outer join basically creates the same resulting set as the inner join, with the difference that at least one line is created in the resulting set for every selected line on the left-hand side, even if no line on the right-hand side fulfils the join_cond condition. The columns on the right-hand side that do not fulfil the join_cond condition are filled with null values.
    Note
    If the same column name occurs in several database tables in a join expression, they have to be identified in all remaining additions of the SELECT statement by using the column selector ~.
    Example
    Join the columns carrname, connid, fldate of the database tables scarr, spfli and sflight by means of two inner joins. A list is created of the flights from p_cityfr to p_cityto. Alternative names are used for every table.
    PARAMETERS: p_cityfr TYPE spfli-cityfrom,
    p_cityto TYPE spfli-cityto.
    DATA: BEGIN OF wa,
    fldate TYPE sflight-fldate,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa.
    DATA itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY fldate carrname connid.
    SELECT ccarrname pconnid f~fldate
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( scarr AS c
    INNER JOIN spfli AS p ON pcarrid = ccarrid
    AND p~cityfrom = p_cityfr
    AND p~cityto = p_cityto )
    INNER JOIN sflight AS f ON fcarrid = pcarrid
    AND fconnid = pconnid ).
    LOOP AT itab INTO wa.
    WRITE: / wa-fldate, wa-carrname, wa-connid.
    ENDLOOP.
    Example
    Join the columns carrid, carrname and connid of the database tables scarr and spfli using an outer join. The column connid is set to the null value for all flights that do not fly from p_cityfr. This null value is then converted to the appropriate initial value when it is transferred to the assigned data object. The LOOP returns all airlines that do not fly from p_cityfr.
    PARAMETERS p_cityfr TYPE spfli-cityfrom.
    DATA: BEGIN OF wa,
    carrid TYPE scarr-carrid,
    carrname TYPE scarr-carrname,
    connid TYPE spfli-connid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH NON-UNIQUE KEY carrid.
    SELECT scarrid scarrname p~connid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM scarr AS s
    LEFT OUTER JOIN spfli AS p ON scarrid = pcarrid
    AND p~cityfrom = p_cityfr.
    LOOP AT itab INTO wa.
    IF wa-connid = '0000'.
    WRITE: / wa-carrid, wa-carrname.
    ENDIF.
    ENDLOOP.

  • How to join two ITAB

    Hai
             i have created an program using ALV and i had created two internal tables namely ITAB and ITAB1.But i wasn't unable to get an output.so i like to know how to join two ITAB in ALV.

    MAhesh,
    Check this ex:
    ITAB1 is having fields  "A","B", "C".
    ITAB2 is having fields  "A","D", "E".
    Create i_final internal table to have all fields of 2 internal tables.
    i_final is having "A","B","C","D","E".
    SORT itab1 ,itab2 by A
    LOOP AT ITAB1.
      READ TABLE itab2 WITH KEY a = itab1-a BINARY
                                                                  SEARCH.
       IF SY-SUBRC EQ 0.
         MOVE : itab1-a  TO i_final-a,
                      itab1-b  TO i_final-b,
                      itab1-c  TO i_final-c,
                      itab2-d  TO i_final-d,
                      itab2-e  TO i_final-e.
        APPEND i_final.
       ENDIF.
    ENDLOOP.
    Don't forget to reward if useful.....

  • How to join two similar layers together?

    Hey all! Please help me out, It is a little thing to do, but I am really stocked at this. How to join two layers together?? For example two Text layers or anything. Pleas can you describe the way to do it and write (if it exist) the shortcut for it?
    Now I know, that layers in AAF can't be joined, there is just a "Pre-Compose". But this function is disabled the FX colone, and I have to have it there.
    In this tut http://www.videocopilot.net/tutorials/shatterize/ he joined two text layers. But with some shortcut so I don't know, how he did it.
    Can anyone help me plz?
    THX for reply

    Lufty09 wrote:
    Yes, but this is disabled the Fx button :/
    Now you need to look up precomposing in the help system. It's all explained there.
    Nesting and precomping are advanced functions and require careful planning or inspired improvisation within the limits of the software. You also need to look up how the rasterization button works in its two operation modes.
    bogiesan

  • How to join two open endpoints?

    How to join two open endpoints?
    I keep getting this error message even though the endpoints do not have this: "To join, you must select two open endpoints. If they are not the same path, they cannot be on text paths nor inside graphs, and if both of them are grouped, they must be in the same group."
    I've ungrouped everything.
    I've tried using the pen tool to manually join.
    I've moved the endpoint, then tried joining them.
    I've tried command+J.
    Same message everytime.
    And if I use the Pathfinder, I'll get unwanted results (i.e. a new path going right though the art)
    What's going on!?

    blueribb,
    While uploading an AI file is unsorted, you may consider at least one option:
    One is that you have at least one hidden extra Anchor Point, either on one of the paths or as stray or belonging to a third path.
    You may find out by:
    1) Using the Direct Selection Tool to click, not drag over, both end Anchor Point and then Cmd+J, and/or
    2) Using the Direct Selection Tool to click, not drag over, each end Anchor Point by itself and then move it a bit.

  • How to join two distribution rule together in one distribution rule

    how to join two distribution rule together in one distribution rule,and every dist. rule has many cost center.

    Hi,
    Welcome you post on the forum.
    You can create a new rule to include these two rules.
    Thanks,
    Gordon

  • How to compare two images through golden Template analysis?

    hi,
       How to compare two images through golden Template analysis?
    Regards
    Dibya 

    Hi Dibya,
    you can skip the pattern matching part if it's not interesting to you. Only look at the "GoldenTemplate"-part.
    I can't (and will not) look at the example in more detail, but generally such examples are given with block diagram...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Getting a black image after joining two images

    Hey Guys,
    I have joined two images. In the joined image. i am getting the first image but the second one im getting as a black image. Can you please tell me what is the problem??
    Below is the code:
    w = inv*img[inv].getWidth(null) + img1.getWidth(null);
         h = Math.max(img[inv].getHeight(null), img1.getHeight(null));
         BufferedImage[] joinedImg = new BufferedImage[lnuInvoiceIndex];
         Graphics2D[] g = new Graphics2D[lnuInvoiceIndex];
    JPEGImageEncoder[] encoder=new JPEGImageEncoder[lnuInvoiceIndex];
         for(int join=0;join<=lnuInvoiceIndex;join++){
    joinedImg[join]=new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    g[join] = joinedImg[join].createGraphics();
    g[join].drawImage((BufferedImage)thumbImage[inv], 0,0, null);
    encoder[join] = JPEGCodec.createJPEGEncoder(response.getOutputStream());
    encoder[join].encode((BufferedImage)joinedImg[join]);
    }

    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.swing.*;
    public class JoinImages {
        private JPanel getContent(BufferedImage[] images) {
            JPanel panel = new JPanel(new BorderLayout());
            panel.add(wrap(join(images, 4)), "Before");
            panel.add(wrap(join(images, 1)), "Last");
            panel.add(wrap(join(images, 2)));
            return panel;
        private BufferedImage join(BufferedImage[] images, int rows) {
            int cols = images.length/rows;
            // For all images having the same size.
            int iw = images[0].getWidth();
            int ih = images[0].getHeight();
            int w = cols*iw;
            int h = rows*ih;
            int type = BufferedImage.TYPE_INT_RGB;
            BufferedImage image = new BufferedImage(w, h, type);
            Graphics2D g2 = image.createGraphics();
            for(int j = 0, index = 0; j < rows; j++) {
                for(int k = 0; k < cols; k++) {
                    int x = k*iw;
                    int y = j*ih;
                    g2.drawImage(images[index++], x, y, null);
            g2.dispose();
            return image;
        private JLabel wrap(BufferedImage image) {
            return new JLabel(new ImageIcon(image),
                              JLabel.CENTER);
        public static void main(String[] args) throws IOException {
            String[] ids = { "-c---", "--g--", "---h-", "----t" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++) {
                String path = "images/geek/geek" + ids[j] + ".gif";
                images[j] = javax.imageio.ImageIO.read(new File(path));
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new JoinImages().getContent(images));
            f.pack();
            f.setLocation(200,200);
            f.setVisible(true);
    }Geek images from [Using Swing Components: Examples|http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html].

  • How to join two partition

    How can I join two partition on my macintosh from System Ultility

    You'll have to be more specific.
    IF you are talking about two partitions that were set up through Boot Camp Assistant and you want to remove windows and go back to one partition, then simply run Boot Camp Assistant again and choose the option to reunite the partitions.
    IF you are talking about two Mac, HFS+ partitions, there is no easy way to do it. The only solution would be to make a backup (easiest by making an image in Disk Utility), and then repartitioning both drives as one, then restoring from the backup image.
    Partitioning is usually a "final" process that cannot be reversed; boot camp is one exception.

  • How to join two lists and display the results in datasheet view.?

    hello,
    i have two lists that i would like to join, i know a method that has been described  in the link below
    http://www.codeproject.com/Articles/194252/How-to-Link-Two-Lists-and-Create-a-Combined-Ciew-i
    however, here the data view is only limited to 30 rows and my resultant list is huge. I would like to know if there is a possibility to view the resultant list in a data sheet view ?

    I don't believe you can use the OOTB Datasheet view when joining lists. However, you should be able to increase your limit from 30 items to as many as you need (that doesn't trip the threshold set in Central Admin).
    Dimitri Ayrapetov (MCSE: SharePoint)

  • How to combine two images in preview onto one page

    Sorry if this topic doesn't go here - there wasn't a "preview" category.
    I have two images that i want to print out on the same page and right now they are each on a separate page in the same file in preview. Does anyone know how I can combine them onto one page?
    Thanks
    Message was edited by: p-rock

    Hi -
    I load two images in Preview and select them.
    !http://www.spotsbeforeyoureyes.com/Preview1.jpg!
    Then I select Print Selected Images:
    !http://www.spotsbeforeyoureyes.com/Preview2.jpg!
    When the print dialog box opens, I select Images per Page:2
    !http://www.spotsbeforeyoureyes.com/Preview3.jpg!
    Hope this helps.
    MtD

  • How to join two MP4 movies with iMovie '11?

    Just after a quick bit of help here.  I'm not a movie making enthusiast so never used iMovie before and never will again most likely.  However I do have 2 mp4 movies about 4 minutes each that I SIMPLY want to join together.
    I've searched and seen reference to dragging the fils into a project then just export as one but for the life of me if import the files I can't seem to find anywhere that provides a view of the two files as thumbnails so I can just drag them to say this one first, this one second.  Join please.  I seem to get streams and streams of individual frames with sliding lines and what not and the best I seem to be able to get is about 4 seconds at a time.  Surely ther MUST be an easy way to just join two movies together without going into advanced frame by frame editing.
    It's not the most intuitive piece of software and I don't have any desire to learn it.  Problem is I am in a **** of rush with this and at the end of a 14 hour image managament day which is making me less than patient with iMovie. 

    QuickTime X can join your two files. Edit menu "Add Clip to End..."

  • How To place two images in a obiee 11g Report Page header

    Hi ,
    Greetings for the day!.
    I want to place two images (one at top left and another at top right ) above the table view . I am not sure how it is called as. i think it is page header . Can anyone let me know how to accomplish this ?
    Kind Regards
    Sudarshan

    Hi,
    Will you pls let me know the best pixel size can be given for both images ?
    Also how can i make the images left and right aligned .Formatting option is not allowing to move the images left or right.
    Pdf output of the report header should display images one at extreme left and extreme right.
    Will you pls let me know whether i can try in single view(title/static/narrative) with html code like below :
    <img src="smiley.gif" alt="Smiley face" align="middle" />
    If so pls provide the details.

  • How to compare two images

    hey frens..i m building a motion detector in java....the problem is this, i have two bufferedimages from webcam...these are consecutive images taken from webcam...i need to compare these two images to check for any changes....i have no idea how to do this...i m trying getRGB() method for this purpose but i think i m not correctly applying it....
    so if anyone have any idea how to do this..plzz reply...

    Take the RGB value from the second image and subtract it from the first.
    If the values are the same, the result will be 0 (or black). If the values are different the result will be 0 < x < 255 and the result will be closer to white.
    This works really well for black and white images.

Maybe you are looking for