com.simiacryptus.util.Util.maximumSize()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.simiacryptus.util.Util.maximumSize()方法的一些代码示例,展示了Util.maximumSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.maximumSize()方法的具体详情如下:
包路径:com.simiacryptus.util.Util
类名称:Util
方法名:maximumSize

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;
}

相关文章