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

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

本文整理了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

  1. @Override
  2. @Nonnull
  3. public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
  4. @Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
  5. try {
  6. if (stdImage != rawImage) {
  7. @Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
  8. ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
  9. }
  10. ImageIO.write(stdImage, "png", file);
  11. } catch (IOException e) {
  12. throw new RuntimeException(e);
  13. }
  14. return file;
  15. }

代码示例来源:origin: com.simiacryptus/java-util

  1. @Override
  2. @Nonnull
  3. public File pngFile(@Nonnull final BufferedImage rawImage, final File file) {
  4. @Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
  5. try {
  6. if (stdImage != rawImage) {
  7. @Nonnull final String rawName = file.getName().replace(".png", "_raw.png");
  8. ImageIO.write(rawImage, "png", new File(file.getParent(), rawName));
  9. }
  10. ImageIO.write(stdImage, "png", file);
  11. } catch (IOException e) {
  12. throw new RuntimeException(e);
  13. }
  14. return file;
  15. }

代码示例来源:origin: com.simiacryptus/java-util

  1. @Override
  2. @Nonnull
  3. public File jpgFile(@Nonnull final BufferedImage rawImage, final File file) {
  4. @Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
  5. if (stdImage != rawImage) {
  6. try {
  7. @Nonnull final String rawName = file.getName().replace(".jpg", "_raw.jpg");
  8. ImageIO.write(rawImage, "jpg", new File(file.getParent(), rawName));
  9. } catch (IOException e) {
  10. throw new RuntimeException(String.format("Error processing image with dims (%d,%d)", rawImage.getWidth(), rawImage.getHeight()), e);
  11. }
  12. }
  13. try {
  14. ImageIO.write(stdImage, "jpg", file);
  15. } catch (Throwable e) {
  16. log.warn(String.format("Error processing image with dims (%d,%d)", stdImage.getWidth(), stdImage.getHeight()), e);
  17. }
  18. return file;
  19. }

代码示例来源:origin: com.simiacryptus/literate-reporting

  1. @Override
  2. @Nonnull
  3. public File jpgFile(@Nonnull final BufferedImage rawImage, final File file) {
  4. @Nullable final BufferedImage stdImage = Util.maximumSize(rawImage, getMaxImageSize());
  5. if (stdImage != rawImage) {
  6. try {
  7. @Nonnull final String rawName = file.getName().replace(".jpg", "_raw.jpg");
  8. ImageIO.write(rawImage, "jpg", new File(file.getParent(), rawName));
  9. } catch (IOException e) {
  10. throw new RuntimeException(String.format("Error processing image with dims (%d,%d)", rawImage.getWidth(), rawImage.getHeight()), e);
  11. }
  12. }
  13. try {
  14. ImageIO.write(stdImage, "jpg", file);
  15. } catch (Throwable e) {
  16. log.warn(String.format("Error processing image with dims (%d,%d)", stdImage.getWidth(), stdImage.getHeight()), e);
  17. }
  18. return file;
  19. }

相关文章