Comments (10)
Unable to reproduce (However not that the Easizer is not up-to-date!)
I have attached a testcase (with version 0.8.4 downloaded from
http://code.google.com/p/java-image-scaling/ ) that works on my machine.
Please let me know if you still have problems.
Original comment by m%[email protected]
on 26 Mar 2010 at 7:33
- Changed state: Fixed
Attachments:
from java-image-scaling.
I'm using version 0.8.4 and experienced the same problem.
int maxheightwidth = 150;
BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
int width = img.getWidth();
int height = img.getHeight();
if (height > maxheightwidth || width > maxheightwidth) {
if (height > width) {
// height > width
float ratio = (float) maxheightwidth / height;
height = maxheightwidth;
width = (int) (ratio * width);
} else {
float ratio = (float) maxheightwidth / width;
width = maxheightwidth;
height = (int) (ratio * height);
}
// image = image.scaleImage(width, height);
}
ResampleOp resampleOp = new ResampleOp(width, height);
resampleOp.setNumberOfThreads(4);
resampleOp.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.Normal);
BufferedImage rescaledImage = resampleOp.filter(img, null);
ByteArrayOutputStream b = new ByteArrayOutputStream();
ImageIO.write(rescaledImage, this.format.toLowerCase(), b);
data = b.toByteArray();
Original comment by [email protected]
on 15 Apr 2010 at 10:53
Attachments:
from java-image-scaling.
Thanks for the feedback.
What version of Java are you using? And on what platform?
Original comment by m%[email protected]
on 16 Apr 2010 at 5:58
- Changed state: Accepted
from java-image-scaling.
I tested this on debian (64 bit):
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode)
and on my local windows 7 machine (64bit):
jdk1.6.0_19 (32 bit as I only had 32 bit imagemagick ddl available)
Original comment by [email protected]
on 16 Apr 2010 at 12:37
from java-image-scaling.
I can reproduce it with the following test case. If you output the rescaled
image as
png, the problem doesn't occur!
I also ran this in a fresh project (with only the filter, junit and
image-scaling
library), so it's definitely not some jar library conflict.
Original comment by [email protected]
on 16 Apr 2010 at 1:40
Attachments:
from java-image-scaling.
I'm pretty sure that the problem only occur if both rescale the image and
change from
one image type to another.
Original comment by m%[email protected]
on 16 Apr 2010 at 2:11
from java-image-scaling.
I can confirm that keeping same image format is reasonable workaround, and to
get format name just use the following code:
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(img.imgData);
ImageInputStream imageInputStream =
ImageIO.createImageInputStream(byteInputStream);
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);
BufferedImage bigImg = ImageIO.read(imageInputStream);
String formatName;
if(imageReaders.hasNext())
{
ImageReader imageReader = imageReaders.next();
formatName = imageReader.formatName;
}
Original comment by [email protected]
on 21 Nov 2010 at 10:06
from java-image-scaling.
I'm closing this bug, since I believe the bug relates to the ImageIO more than
ImageScaling library.
Original comment by m%[email protected]
on 5 Feb 2011 at 1:43
- Changed state: WontFix
from java-image-scaling.
So if someone has to do it how can it be done?
Original comment by [email protected]
on 20 Apr 2011 at 9:14
from java-image-scaling.
You can use the workaround suggested by marcin:
http://code.google.com/p/java-image-scaling/issues/detail?id=18#c7
Original comment by m%[email protected]
on 20 Apr 2011 at 7:04
from java-image-scaling.
Related Issues (20)
- DimensionConstrain class is written in a way that cannot be extended HOT 3
- Problem with images rotating after scaling HOT 1
- Create square pic HOT 2
- Upscaling shift HOT 3
- proportional scaling HOT 1
- Rescaling with alpha HOT 1
- Jar file incomplete HOT 1
- Naming error: ThumpnailRescaleOp Thump -> Thumb HOT 1
- ArrayIndexOutOfBoundsException when upscaling a very small image HOT 2
- When scale images smaller than 150kb, the resulting image comes out like a negative HOT 16
- Code cleanup & ant unit test tasks
- Wrong license refererenced in maven pom file
- Incorrect implementation of getBounds2D and getPoint2D HOT 1
- Android version
- Aspect Ratio Issue HOT 1
- e.printStackTrace() inside a catched exception HOT 3
- Resize fails for TYPE_USHORT_GRAY image
- Adding method ResampleFilters.valueOf(String name)
- Push version 0.8.6 to maven central HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-image-scaling.