මේ JAVA කෝඩ් එක මොකක්ද ගුපියනේ ??

lilman

Well-known member
  • May 10, 2009
    40,962
    54,539
    113
    Colombo
    මේ කෝඩ් එකේ නම මොකක්ද ?



    එම්බේඩ් වෙන්නෙ නෑ.එෆ් බී එකේ බලන්න.
     
    • Like
    Reactions: kinkon

    hasithayad

    Well-known member
  • Sep 28, 2011
    30,793
    1
    45,000
    113
    image generation tool එකක් බන්. කෘතිම බුද්ධි මගුලක් නෑ. වැඩිම උනොත් මුන් lambda function එකක් ලියාගෙන ඇති website ටික browse කරලා average එක හොයාගන්න. cloud මුකුත් ඕනෙ නෑ. ඒකත් ඔය කෝඩ් එකේම ලියතෑකි. price එක calculate කරගෙන, ඕනෙ කරන text ටික database එකෙන් අරන් base image එකට දාන එක කරන්නෙ. එච්චර මහලොකු දෙයක් නෙවෙයි. .net GDI වලින් ලේසියෙන් ලියන්න පුලුවන්
     
    • Like
    Reactions: lilman

    Nanosudha

    Well-known member
  • Dec 28, 2012
    5,150
    4,909
    113
    Java:
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import javax.imageio.ImageIO;
    
    public class ImageEmbedder {
        public static void main(String[] args) {
            // Load the base image template and the images to embed
            BufferedImage baseImage = loadImage("base_image.png");
            BufferedImage image1 = loadImage("image1.png");
            BufferedImage image2 = loadImage("image2.png");
    
            // Create a Graphics2D object to draw on the base image
            Graphics2D g2d = baseImage.createGraphics();
    
            // Embed the first image onto the base image at position (x1, y1)
            int x1 = 100;
            int y1 = 100;
            g2d.drawImage(image1, x1, y1, null);
    
            // Embed the second image onto the base image at position (x2, y2)
            int x2 = 300;
            int y2 = 200;
            g2d.drawImage(image2, x2, y2, null);
    
            // Save the modified base image as a new file
            saveImage(baseImage, "output_image.png");
        }
    
        // Helper method to load an image from a file
        public static BufferedImage loadImage(String filePath) {
            BufferedImage image = null;
            try {
                image = ImageIO.read(new File(filePath));
            } catch (Exception e) {
                e.printStackTrace();
            }
            return image;
        }
    
        // Helper method to save an image to a file
        public static void saveImage(BufferedImage image, String filePath) {
            try {
                ImageIO.write(image, "png", new File(filePath));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    Note: Update X,Y based on your own base template
    By: chat.openai.com
     
    Last edited: