如何在不损失质量的情况下放大java中的图像

如何在不损失质量的情况下放大java中的图像

本文介绍了如何在不损失质量的情况下放大java中的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java中的图像。我有一组图像 - 比方说每个600x800像素。
我以100x100调整它们的大小,我在上面做了一些东西。现在我想在开始尺寸放大图像而不会失去我的变化和像素质量。这可能吗?

I am working with images in Java. I have a set of images - let's say 600x800 pixels each.I resize them at 100x100 and I make some stuff on it. Now I would like to enlarge the image at the beginning size without losing my changing and pixel quality. Is this possible?

推荐答案

没有。这也不是一个Java问题。你会怎么用图像编辑器做到这一点?如果你调整两次(特别是小于大一些),你将失去质量。

No. This also isn't really a Java question. How would you do this with an image editor? If you resize twice (especially smaller than larger), you're going to lose quality.

你最好的选择是保持原始分辨率,然后使用矢量图形绘制你需要什么 - 消除任何不必要的大小调整。 (IE,计算您需要绘制的内容,考虑当前大小 - 无需先调整大小为100x100。)这也将解决您在宽高比方面可能遇到的一些问题 - 就像您将100x100的大小调整回600x800,无论你添加什么,都会显得拉伸/更宽。

Your best bet is to keep the native resolution, then use vector graphics to draw what you need - eliminating any unnecessary resizing. (I.E., calculate what you need to draw, taking into account the current size - without first resizing to 100x100.) This will also fix some issues you're also probably seeing regarding the aspect ratios - as when you would resize from 100x100 back to 600x800, whatever you added is going to appear "stretched" / wider.

这篇关于如何在不损失质量的情况下放大java中的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:32