我正在使用 Java 中的Marvin 图像处理框架,我正在努力缩放图像。它只是制作一个黑色方块,你能看到我做错了什么吗?设置的阈值有效。
package com.example.marvin;
import marvin.image.MarvinImage;
import marvin.io.MarvinImageIO;
import marvin.plugin.MarvinImagePlugin;
import marvin.util.MarvinPluginLoader;
public class Imageprocess {
public static void main (String[] args) {
MarvinImage image = MarvinImageIO
.loadImage("/Users/unknown1/Desktop/images.jpeg");
MarvinImagePlugin thresholdplugin = MarvinPluginLoader
.loadImagePlugin("org.marvinproject.image.color.thresholding.jar");
MarvinImagePlugin scaleplugin = MarvinPluginLoader
.loadImagePlugin("org.marvinproject.image.transform.scale.jar");
thresholdplugin.setAttribute("threshold", 85);
thresholdplugin.process(image, image);
scaleplugin.setAttribute("newWidth", 50);
scaleplugin.setAttribute("newHeight", 37);
scaleplugin.process(image, image);
image.update();
MarvinImageIO.saveImage(image, "/Users/unknown1/Desktop/images1.jpeg");
}
}