(int width)
| 1741 | /// |
| 1742 | /// the newly created image |
| 1743 | public Image scaledWidth(int width) { |
| 1744 | float ratio = ((float) width) / ((float) getWidth()); |
| 1745 | return scaled(width, Math.max(1, (int) (getHeight() * ratio))); |
| 1746 | } |
| 1747 | |
| 1748 | /// Scales the image to the given height while updating the width based on the |
| 1749 | /// aspect ratio of the height |