1.代码如下package com.tddlmj.rstar.util;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import static java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC;
/**
* 封面是674/1000
* s---103
* b----182
*/
public class ImgUtil {
public static void convertToWidth(float width, String path) {
}
/**
* Resizes an image to a absolute width and height (the image may not be
* proportional)
*
* @param inputImagePath Path of the original image
* @param outputImagePath Path to save the resized image
* @param scaledWidth absolute width in pixels
* @param scaledHeight absolute height in pixels
* @throws IOException
*/
public static void resize(String inputImagePath,
String outputImagePath, int scaledWidth, int scaledHeight)
throws IOException {
// reads input image
File inputFile = new File(inputImagePath);
BufferedImage inputImage = ImageIO.read(inputFile);
// creates output image
// BufferedImage outputImage = new BufferedImage(scaledWidth,
// scaledHeight, inputImage.getType());
BufferedImage outputImage