Gianfra
Gianfra

Reputation: 1149

How might I enlarge image in java without losing quality?

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?

Upvotes: 1

Views: 1259

Answers (2)

ziesemer
ziesemer

Reputation: 28687

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.

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.

Upvotes: 5

Matt Brock
Matt Brock

Reputation: 5391

I would like to enlarge the image at the beginning size without losing my changing and pixel quality. Is this possible?

Yes, it's possible and very simple.

Here's how you do it: use your original.

Upvotes: 0

Related Questions