private void calcImageSizes() {

		double labelRatio = (double) getWidth() / (double) getHeight();
		double imageRatio = (double) image.imagewidth / (double) image.imageheight;

		if (labelRatio <= imageRatio) {
			imagePosX = 0;
			imageSizeX = getWidth();			
		}
		else {
			 imageSizeX = (int) (getWidth() * (imageRatio / labelRatio));
			 imagePosX = (getWidth() - imageSizeX) / 2;
			 imageSizeX += imagePosX;			
		}
		
		if (labelRatio >= imageRatio) {
			imagePosY = 0;
			imageSizeY = getHeight();
		}
		else {
			imageSizeY = (int) (getHeight() * (labelRatio / imageRatio));
			imagePosY = (getHeight() - imageSizeY) / 2;
			imageSizeY += imagePosY;
		}
		
	}