How do I draw a rectangle on an existing png image using java -


i have png image saved in local pc. want open(load) image , draw rectangle on image @ specified location (x, y, width, height) using java. can me this...

equivalent c# code below. want java version same


        image oriimage = // load file         rectangle rect = new rectangle(0, 1824, 1080, 96);         bitmap eleimg = new bitmap(oriimage, (int)(oriimage.width / rate), (int)(oriimage.height / rate));          graphics g = graphics.fromimage(eleimg);         g.drawrectangle(new pen(color.red, 5), rect); 

you make use of 2d graphics api

bufferedimage img = imageio.read(...); graphics2d g2d = img.creategraphics(); g2d.setcolor(color.red); g2d.drawrect(0, 0, 100, 100); g2d.dispose(); 

take @

for more details


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -