本文整理了Java中com.simiacryptus.util.Util.maximumSize()
方法的一些代码示例,展示了Util.maximumSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.maximumSize()
方法的具体详情如下:
包路径:com.simiacryptus.util.Util
类名称:Util
方法名:maximumSize
[英]Resize buffered png.
[中]调整缓冲png的大小。
代码示例来源:origin: com.simiacryptus/literate-reporting
@Override
@Nonnull
public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
try {
if (stdImage != rawImage) {
@Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
}
ImageIO.write(stdImage, "png", file);
} catch (IOException e) {
throw new RuntimeException(e);
}
return file;
}
代码示例来源:origin: com.simiacryptus/java-util
@Override
@Nonnull
public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
try {
if (stdImage != rawImage) {
@Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
}
ImageIO.write(stdImage, "png", file);
} catch (IOException e) {
throw new RuntimeException(e);
}
return file;
}
代码示例来源:origin: com.simiacryptus/java-util
@Override
@Nonnull
public File jpgFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
if (stdImage != rawImage) {
try {
@Nonnull final String rawName = file.getName().replace(".jpg", "_raw.jpg");
ImageIO.write(rawImage, "jpg", new File(file.getParent(), rawName));
} catch (IOException e) {
throw new RuntimeException(String.format("Error processing image with dims (%d,%d)", rawImage.getWidth(), rawImage.getHeight()), e);
}
}
try {
ImageIO.write(stdImage, "jpg", file);
} catch (Throwable e) {
log.warn(String.format("Error processing image with dims (%d,%d)", stdImage.getWidth(), stdImage.getHeight()), e);
}
return file;
}
代码示例来源:origin: com.simiacryptus/literate-reporting
@Override
@Nonnull
public File jpgFile(@Nonnull final BufferedImage rawImage, final File file) {
@Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
if (stdImage != rawImage) {
try {
@Nonnull final String rawName = file.getName().replace(".jpg", "_raw.jpg");
ImageIO.write(rawImage, "jpg", new File(file.getParent(), rawName));
} catch (IOException e) {
throw new RuntimeException(String.format("Error processing image with dims (%d,%d)", rawImage.getWidth(), rawImage.getHeight()), e);
}
}
try {
ImageIO.write(stdImage, "jpg", file);
} catch (Throwable e) {
log.warn(String.format("Error processing image with dims (%d,%d)", stdImage.getWidth(), stdImage.getHeight()), e);
}
return file;
}
内容来源于网络,如有侵权,请联系作者删除!