java - How to blend two image -


I want to combine two images together with a ratio of 4: 1

Should be such as

enter image details here

then what Any ideas? The question is unclear, but you can use the 2D graphics API

  Try {BufferedImage base = imageIO.read (new file ("base.jpg")); Buzzed Image Overlay = Images Reed (new file ("overlay .jpg")); Graphics2D g2d = base.createGraphics (); G2d.setComposite (AlphaComposite.SrcOver.derive (0.5f)); Int x = (base.getWidth () - overlay.getWidth ()) / 2; Int y = (base.getHeight () - overlay.gethight ()) / 2; G2d.drawImage (overlay, x, y, tap); G2d.dispose (); ImageIO.write (base, "jpg", new file ("blended .jpg")); } Hold (IOException e) {e.printStackTrace (); }  

results in ...

blending

For more information ...

  • / P>


    Comments

    Popular posts from this blog

    apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

    c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

    c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -