java - How to blend two image -
I want to combine two images together with a ratio of 4: 1
Should be such as
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 ...
For more information ...
/ P>
Comments
Post a Comment