GithubHelp home page GithubHelp logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 21, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.