[I sent this earlier to firstname.lastname@example.org but it didn't show up
I read Chris Campbell's article on image scaling the other day:
In the comments Chris mentioned that for very large images it is
better to first use ImageIO subsampling to reduce the image first, and
then use traditional scaling methods to reduce it further.
In my own applications I use subsampling quite heavily (we often have
5000x5000 images which only need to be 100x100 on the screen). The
problem has always been that the subsampling in ImageIO is really
crude--it actually just picks out every Nth column/row and tosses all
the rest. After reading much too much about sampling theory it was
revealed that the solution is to use a low pass filter on the original
image before downscaling, for example a Gaussian blur. If you combine
this with the subsampling algorithm it isn't even terribly expensive,
because you only have to calculate the blur for each of the output
This inspired me to add this feature to my PNG decoder library
(http://javapng.sf.net/). To subsample every 4th row/column the sample
code would be something like:
PngConfig config = new PngConfig.Builder()
.sourceSubsampling(4, 4, 0, 0)
BufferedImage image = new PngImage(config).read(new File("test.png"));
I've tested the result on the demo image from Chris' article and the
result is on par with the best of the scaling algorithms shown there
Now, besides being an infomercial the real reason for this message is
to plead for a similar feature in ImageIO, if only for JPEG images. I
just don't have it in me to write a JPEG decoder too :-) Maybe there
is already a third-party library that does this? Does a RFE have any
p.s. In case anyone is listening the bugs I reported in the PNG
metadata spec are now over five years old:
To unsubscribe, send email to email@example.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
firstname.lastname@example.org and include in the body of the message "help".
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.