-1

Guys sorry if this would sound a bit embarrassing. Can anyone help with how to calculate average dimension of image sizes.

Dimension d = new Dimension (d);
//where: 
int width = (int)d.getWidth
int heigth = (int)d.getHeigth

===> image size = (width, length);
//Example
image1 = (200, 350);
image2 = (250, 280);
image3 = (340, 260);

How can the average size be calculated for the 3 images???

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
K. Sun
  • 1
  • 4

1 Answers1

1
Dimension result = new Dimension()
result.width = image1.getWidth() + image2.getWidth() + image3.getWidth();
result.height = image1.getHeight() + image2.getHeight() + image3.getHeight();
result.width /= 3;
result.height /= 3;

Basically, just do it like you would any other average.

resueman
  • 10,572
  • 10
  • 31
  • 45