Smooth image scaling is not so smooth

Okay, comparing jdk1.6.0_05 with Photoshop CS2 with respect to their ability to do smooth bicubic scaling is a bit unfair.
However - the end result is so different, that I'm tempted to report this as a bug.
Code:
g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);* [Original image 1028x2000 GIF|http://konzoomer.com/3-0020662000064.gif]
* [Scaled with Photoshop CS2 122x237 JPG|http://konzoomer.com/3-0020662000064-scaledWithPhotoshop.jpg]
* [Scaled with Java 6 122x237 JPG|http://konzoomer.com/3-0020662000064-scaledWithJava1.6.0_05.jpg]
So - is there any way to get closer to the photoshop result? Have I missed a vital rendering hint?

Steel wrote:
Even though he was posting an advertisement, I think he is right: A single recomendation for a commercial product isn't treated as a violation of the CoC. All the user karimchik posted for the last 3 years were links to the same commercial product.
There are sites and forums which have announcement and advertising sections, where such persons may post without violating any rules. This doesn't happen to be one of them.
Identified advertisers will be blocked without mercy.
Still, I hope someone at Sun will look at this sometime.Um, you'll only find volunteers here. AFAIK there are no Sun employees who frequent the forums.
Maybe you could consider filing a RFE.
db

Similar Messages

  • Image scaling changes

    Before I started here, the team was using FrameMaker 8 and migrating to FM 10. During the migration, we noticed that images in the documents we opened, converting them to FM10, had their image scaling data changed.
    Typically, we acquire screen shots using the highest resolution screen supported - mine is currently set at 1440 x 900. We scale the images to a width of 510 pixels (optimally) but no more than 600 pixels in our screen capture utility. We save the screen shots as Grayscale JPEGs. This process has, historically, provided images that fit our text column flow perfectly.
    In previous versions of FM, the images imported by reference appeared as 100% scaling in the FM image properties. Now, they appear as 75% scaling. We're wondering why and if there is any effects we need to be aware of in terms of PDF and HTML Help file sizes.
    While testing the import process, looking to see if the FM scaling data affected the image size, we saw that the pixel dimensions given by SnagIt varied wildly from the pixel dimensions given by FM. For example, the SnagIt dimensions for one image indicated it was 505x493 pixels whereas FM gave the dimensions of the source file as 507x315 pixels. Both are, as far as I know, giving me the source file dimensions but they are different.
    We might not have noticed this, the images looked okay, but we were carefully going through the transition to FM10 and looking at every detail.
    Question: why is FM10 auto-scaling the images to 75%?
    Question: does this scaling do anything to our output that we need to be aware of?
    Question: why do we get two different dimension data from the two software packages?
    Thanks,
    Wanda

    We  save the screen shots as Grayscale JPEGs.
    Are the screen images contone (e.g. real-world photos, CGI imagery),
    or flat (e.g. dialogs, line art)? JPEG uses curve-matching compression,
    which is great for tones that vary smoothly, but introduces nasty ringing
    edge artifacts on sharp edges of flat tones.
    TIF(zip), uses repeat-count compression, and is both non-destructive to flat
    tone images, and often compresses them more efficiently. We use EPS
    for the import format (no compression) and let Distiller or Acrobat post
    determine the compression to use.
    This process has,  historically, provided images that fit our text column
    flow perfectly.In  previous versions of FM, ...
    What is the target delivery format?
    ... the images imported by reference appeared as  100% scaling in
    the FM image properties. Now, they appear as 75%  scaling.
    In case you want to try it, I have never seen imported EPS objects
    change size when migrating a document to a later rev of FM.
    We import using 96 dpi.
    If the target is PC screen display at 100% page size, that's probably a
    decent target. PC screen resolutions today probably range from 80 to
    110 dpi, and I'd guess that 96 is very close to the sweet spot.
    We use (and I favor) bringing in all contone content at 200 dpi or
    higher. We bring bitmap (bi-level line art) in at 600. But then our
    target media is 600 dpi B&W bitmap on paper. However, we like
    to give web readers of the PDFs reasonable detail in images.
    Apple's "Retina" crusade is trying to move the industry to 300 dpi
    displays. I'd be happy with 200.

  • Image scaling produces moire

    I use Labview 8.01 and need to read grayscale images (bmp, png) and fit them to user window for display.
    Images are scaled via entering a scaling factor into property node for the frontpanel display. If the scaling factor is larger or equal to one, everything is fine. But when I use a factor smaller than 1, the image size is correctly changed, but the smaller image contains e.g. black lines where only smooth gray fields are in the original image. Maybe that is due to a bad scaling algorithm, but of course I cannot change it.
    Any idea to solve this problem?
    Attached are screenshots of the problem, a VI to quickly test it and an example image file.
    Attachments:
    scale05.jpg ‏36 KB
    scaletest.vi ‏20 KB
    test.png ‏130 KB

    @chrisger:
    When opening your file, Labview does not find a file called IMAQ ReadFile. If I ignore it, the VI opens without this file. I have installed the IMAQ package... see attached screenshot.
    There I discovered another problem with your file: It only allows integer values for scaling, but not the critical range between zero and one.
    I tried one VI supplied by NI to which I just have added the image selector, and even this file shows the same behaviour as my own one does. I also attached this version.
    Message Edited by chrbesold on 07-26-2006 10:00 AM
    Attachments:
    imaq.jpg ‏24 KB
    Picture Control - Zoom Attribute.vi ‏113 KB

  • Image resize quality not saved in Save For Web Preset?

    L.S.,
    I have been working on an Action to create 12 separate PNG's for further use in my icon-software. What I do is basically this:
    Start out with a 256x256px image, save it for web four times in steps from 256, 48, 32 and 16px, (32-bit)
    apply some masks / layers, save it for web again four times from 256-16px,  (8-bit)
    set the mode to indexed colour / apply other masks and layers, and save it for web again from 256-16px. (4-bit)
    I let the sizing be done in the Save for Web step.
    The 256-sized pics give me no problem as they are not scaled down.
    The 32-bit pics give me no problem as they are scaled down, and antialias comes along, but they have 8-bit transparency: no problem.
    In the 8-bit and 4-bit versions from 48-16px, I definitely want no antialias in the sized down versions. So I set the resize quality to 'Nearest Neighbor'.
    However, Photoshop seems not to be able to remember different resize qualities in one Action.
    In every Save for Web-action that I do, when I set it to resize, it does so. But the resize quality is not taken from the setting. It seems to be taken from the last used or recorded setting.
    That is pretty annoying, because:
    - When I let the downscaled ones of the first 4, be downscaled 'bicubic sharper'
    - And I let the downscaled ones of the second 4, and third 4, be downscaled 'nearest neighbor'
    Next time I run the Action, all downscaling is done by 'nearest neigbor'. That ruins my downscaled 32-bit icons - they get jaggy.
    If I alter the steps in the action manually and set the first ones to 'bicubic sharper' again, suddenly all downscaled ones are done by 'bicubic sharper'.
    That ruins my downscaled 8-bit and 4-bit icons: they get antialias, to lime green, and that shows...
    I can save Presets in the Save For Web dialog, but as the groupbox already tells me: these presets only apply to the Image quality parameters, not to the sizing parameters. Those seem to be taken from the last run.
    I have one alternative to this: before every Save for Web step, I downsize the image myself, and undo the history step after saving. It's quite some work and I would just rather see that the sizing parameters saved in the Preset!

    That's never been saved as part of the S4W presets. Bloody annoying.

  • Image.getScaledInstance() does not always work under Windows Vista

    Hi:
    I've run into some intermittent image scaling problems under Windows Vista (minus Aero effects) that I never experienced with the same program, same image(s), running same Java version under XP. The images I'm using are all JPEGs, and the problem appears to affect approx 1 out of 3 grayscale images (no color ones so far) w/o respect to size (ie: small ones can be problems while larger ones will work). Java -version shows 1.6.0_02-b06. I was wondering if anyone else out there has seen this, or can point out what I may be doing wrong. Sample code to duplicate follows.
    Tx,
    Jallewel
    // ===================================================================
    // Image Scaling Problem, Description & Demo Program (minus the image):
    //   Environment:  SDK/JRE: Java 1.6.0_02-b06, running under
    //        Windows Vista Home Premium (32-Bit) on Dell Inspiron w/3GB RAM
    //   ************* Symptoms ******************
    //   Problem occurs when invoking image.getScaledInstance().
    //   Problem shows up under Windows Vista, configured w/Windows Classic look
    //       & feel - that is, with Aero effects turned OFF.
    //   Problem does NOT show up under Windows XP on Dell Dimension 4500.
    //   Test across computers used same SDK/JRE, Java program, and Image.
    //   Problem ONLY appears in grayscale JPEG images, and only 1 out of 3 of those.
    //   (I can provide a problem image)
    // Results Compiling & Running This Program:
    //   C:\Users\~\VistaProblem>javac VistaProblem.java
    //   C:\Users\~\VistaProblem>java VistaProblem
    //      Uncaught error fetching image:
    //      java.lang.ClassCastException: [I cannot be cast to [B
    //        at java.awt.image.ColorModel.getAlpha(Unknown Source)
    //        at java.awt.image.ColorModel.getRGB(Unknown Source)
    //        at sun.awt.image.ImageRepresentation.convertToRGB(Unknown Source)
    //        at sun.awt.image.ImageRepresentation.setPixels(Unknown Source)
    //        at java.awt.image.AreaAveragingScaleFilter.accumPixels(Unknown Source)
    //        at java.awt.image.AreaAveragingScaleFilter.setPixels(Unknown Source)
    //        at sun.awt.image.ImageDecoder.setPixels(Unknown Source)
    //        at sun.awt.image.JPEGImageDecoder.sendPixels(Unknown Source)
    //        at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
    //        at sun.awt.image.JPEGImageDecoder.produceImage(Unknown Source)
    //        at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
    //        at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
    //        at sun.awt.image.ImageFetcher.run(Unknown Source)
    import java.*;
    import java.awt.*;
    import java.io.*;
    import javax.imageio.*;
    // class VistaProblem
    public class VistaProblem extends Frame {
       private static ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
       public static ImageComponent ic;
       // Constructor
       public VistaProblem() {
          super("VistaProblem");
          add(sp, BorderLayout.CENTER);
          this.setSize(700, 520);
          setVisible(true);
         String fPathName = "./ProblemImage.jpg";
          ic = new ImageComponent(getToolkit().getImage(fPathName));
          sp.add(ic);
          sp.validate();
          ic.Scale(220, 200);
       // class ImageComponent
       class ImageComponent extends Component {
          private Image image;
          // Constructor
          ImageComponent(Image img) {
             this.image = img;
          // paint
          public void paint(Graphics g) {
             g.setColor(getBackground());
             g.drawImage(image, 10, 10, this);
             g.dispose();
          // Scale
          public void Scale (int width, int height) {
             // ***** PROBLEM LINE HERE; COMMENT OUT AND PROGRAM WORKS *****
             this.image = this.image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
             repaint();
       // Main Entry Point
       public static void main(String args[]) {
          Frame f = new VistaProblem();
    } // end VistaProblem

    That does indeed appear to be a bug. I looks like it's having problems with the alpha value in the color model, so a possible workaround would be to change the color model the image uses before scaling. This may entail creating a new BufferedImage and drawing the old image into it.

  • Object scaling does not seem to work correctly with objects containing Bezier curves

    I created a closed object that had a Bezier curve as part of it's definition. I wanted to scale it by 110% and then use this second enlarged object to create a sort of a background underneath the first object to create a sort of a shadow effect. But rather than the second object being uniformly larger than the first it intersects the original object in ways that don't make sense to me.
    Is there an easier/differnt way to create an effect like this? I can do it but have to manually adjust a lot of points in the new object so that they create a uniformly larger version of the original object but it's a lot of effort for something that works fine for normal polygons with straight lines (e.g. a star with 5 points).
    Thanks for any suggestions or ideas.
    -Bubba
    ps - i've attached an image of what I get with this technique of creating two examples of two objects one a 110% scale version of the other. The first star shows the effect I'm trying to get and the second shows the problem (the red border does not surround the black object uniformly around the perimeter)

    Bubba,
    Referring to post #16 (trying to get it more right from the start than in post #15),
    the scaling will be symmetric with parallel segments if the original object is rotationally symmetric and reflectionally symmetric about two orthogonal axes, and that is also the case.
    The scaling of the object in post #16 is in fact symmetric because corresponding segments of original and scaled object have the same distance all the way round.
    The five star in the OP is rotationally symmetric but only reflectionally symmetric about one axis, so the segments are parallel, but the scaling is not symmetric because there different distances between corresponding segments, even though you were actually satisfied with it:
    The first star shows the effect I'm trying to get and the second shows the problem
    This could be mended by scaling from the centroid.
    If you need to have the same distance between all the segments of original and scaled object, with scaling you are restricted to objects where all segments start and end at the same distance from the centroid, as in regular polygons (including the square), regular stars, and the circle (with its curved segments). Objects with curved segments derived from regular polygons and stars will have varying distances and non parallellism within each segment.

  • Problems with image scaling

    I'm facing a real problem with image scaling
    I've used several algorithms but it all has defects but the most common thing is the out of memory error after several enlargments...
    does any one know a solution...
    note:
    I've used several packages to do so,but I'm looking for a solution from the jdk itself
    JAlexscorpio

    Did you take into account that the getScaledInstance() -method creates a completly new Image?
    So if you use it like in
    ImageIcon icon1=new ImageIcon("Blah.gif");
    ImageIcon icon2=new ImageIcon(icon1.getImage().getScaledInstance(400,400,SCALE_FAST);
    you will end up with 2 different Images which have their own data and memory requirements.
    even if you use something like
    ImageIcon icon1=new ImageIcon("Blah.gif");
    Image i=icon1.getImage();
    icon1.setImage(i.getScaledInstance(200,200,SCALE_FAST));
    You will need enough memory to store the data for the original image, as well as the data for the scaled
    version of the image, at least for the time that it take the JRE to create the scaled version. You never know when the garbage collector kicks in to delete you old data so it could be that this takes some time and until
    that moment your memory is not available. If your now doing several of the scaling operations, and there is no chance for the garbage collector to do its work, you will run out of memory.
    I hope that might help, if not feel free to post again

  • ComboBoxRenderer with image scaling

    hi all,
    I would like to know how to make the comboBoxRender with image scaling. Because my combo box is smaller than the image that I want to put inside..
    currently, I "extends JLabel implements ListCellRenderer", but if I call setIcon to the Label, it is not scale to the combo size..., so I think is it need to extends another type of component ?
    Could some of you give me a suggestion , better provide me a simple code.. Many Thanks for help.

    Hi,
    I've extended the Icon framework to support scaling. I never tried it with cell renderers, but maybe it works:
    Extend JXIconLabel, set the zoomingStrategy to FullZooming.RESPECTING_ASPECT_RATIO_INSTANCE and set the XIcon (eg. a XImageIcon).
    Maybe it works. (The library is open source.)
    http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JXIconLabel.html
    Homepage:
    http://www.softsmithy.org
    Download:
    http://sourceforge.net/project/showfiles.php?group_id=64833
    Source:
    http://sourceforge.net/svn/?group_id=64833
    http://softsmithy.svn.sourceforge.net/viewvc/softsmithy/trunk/lib/src/org/softsmithy/lib/
    API:
    http://softsmithy.sourceforge.net/lib/docs/api/index.html
    If you have questions just ask me!
    -Puce

  • Image Scaling Percentage

    I am converting from Quark 6.0 to Indesign CS3 and have a comparison question.
    When viewing an image within Quark you can get specifics about the images scaling percent ratio. IE: 100%, Reduced would be obviously 99.99% to 10% or enlarged would be obviously 100.1% to 150%.
    Is there anyway to see that kind of percentage in InDesign. We try to stay under 150% and above 10% for our printer specifications, so it will make things very difficult if we can not view that info like in Quark.
    Any help is greatly appreciated!!

    I guess what I was hoping for is for the % to actually give its configuration from the original 100% instead of saying that it 100% after it has been reduced or enlarged. Between the info and the % it more or less makes sense, but it is not exact and I guess the user has to somewhat guess? Seems like more work for the user.
    Thanks for your help!!

  • VI Method "Front Panel:Get Image Scaled" Memory Error 17

    Hi all, I've got two almost identical sub vi front panels that I'm dumping to a jpg image for reporting purposes.  One was copied and slightly modified from the other to show a different data set and plot.  The original works just fine, but the second sub vi, when using the "Front Panel:Get Image Scaled" method to pass the image to write the jpg, always returns the following error:
    "Error 17 occurred at Invoke Node in Myprogram
    Possible reason(s):
    LabVIEW:  Not enough memory to manipulate image.
    =============================
    NI-488:  Unrecognized command.
    Method Name: Front Panel:Get Image Scaled
    [Continue] [Stop]  "
    I've stripped the problem section into a simple tiny new that only opens the report and tries to get the image with the same working/non-working result above.  Using the Execution Trace Highlighter, it error is definitely occuring when the Method executes.
    Any ideas?  Thanks.

    Hey cjgpr,
        I haven't been able to dig up much info on this error message.  There's one other discussion forum post that talked about it some, and a KnowledgeBase article on it.  It seems that whatever changes you made to the front panel have caused it to exceed your computer's memory when creating an image.  Try removing items until it works, then see what actually breaks the functionality.
    Brian B
    Field Sales Engineer
    Tennessee/Southern Kentucky
    National Instruments

  • s:BitmapImage get image scaled size and position after it loaded and scaled

    I am try to know the dimensions of the uploaded image into <s:BitmapImage without success.
    The data coming back to me are isthe real image size and not size after it was scaled to fit the component size.
    I can see that the image scaled down and fit to the maxWidth, but I can't get the actual/real scaled width from the BitmapIMage properties.
    I tried:
    <s:BitmapImage id="mainBitMap"  ready="mainBitMap_readyHandler(event)" complete="bitmapimage1_completeHandler(event)" source="{data.Thumbnail.URL}" maxHeight="250" maxWidth="250" scaleMode="letterbox"/>
      protected function bitmapimage1_completeHandler(event:Event):void{ 
    trace("----------------------Start-----------------------"); 
    trace("mainBitMap.bitmapData.width" + mainBitMap.bitmapData.width); 
    trace("mainBitMap.width" + mainBitMap.width); 
    trace("mainBitMap.measuredWidth" + mainBitMap.measuredWidth); 
    trace("mainBitMap.displayObject.width" + mainBitMap.displayObject.width); 
    trace("mainBitMap.explicitWidth.width" + mainBitMap.explicitWidth); 
    trace("mainBitMap.preliminaryWidth" + mainBitMap.preliminaryWidth); 
    trace("mainBitMap.sourceWidth" + mainBitMap.sourceWidth); 
    trace("-----------------------End------------------------");
    Result:
    ----------------------Start-----------------------
    mainBitMap.bitmapData.width=435
    mainBitMap.width=0
    mainBitMap.measuredWidth=0
    mainBitMap.displayObject.width=0
    mainBitMap.explicitWidth.width=NaN
    mainBitMap.preliminaryWidth=NaN
    mainBitMap.displayObject.preliminaryWidth=435
    -----------------------End------------------------
    Thanks,
    Nimrod.

    Hi,
    I tried the ready event, But I still receive the same results.
    I expect to get the new scaled width And height according to the maxHeight and MaxWidth.
    I see that the image scaled to fi it But I can't recive the new size of it.
    Thanks,
    Nimrod

  • Error 53 : BD.Get Image Scaled

    Hi,
    I used invoke node(method block diagram:get image scaled) to get a screenshot of block diagram of a VI. It works well in LabView 8.6. But with the application built based on the VI, I got a 53 error code. Any suggestion?

    >>"Built" as in built into an .exe file?
    >>
    >>If
    so, you can't get an image of the block diagram because the block
    diagram is removed from the VI's when they are built into the
    executable.  The only thing present is any needed front panels, and the
    underlying compiled code that is built from the block diagram.
    >>
    >>For what reason do you want to capture an image of the block diagram?
    1. Yes, it is a .exx file.
    2. The application is used to generate screenshot of a user specified VI, not a VI built into the executable.

  • TS2518 Help, I had aperture open and working on a image and did not have a battery in and bumped the power off. As a result it will not open my master, it is locked. when I try to open that Library  it says There was an error opening the database for the

    Help, I had aperture open and working on a image and did not have a battery in and bumped the power off. As a result it will not open my master, it is locked. when I try to open that Library  it says There was an error opening the database for the library. I have tried every thing. I updated the other libr but now it will not open the main to update. What do I do?

    Try starting Aperture with the command and option keys held down.  You'll get 3 options.
    Try each, starting at the top, in order, checking after each to see if it fixes the issue.

  • After upgrading to Lion Image Capture does not work, even though it is intel software.  Gives error 9931.  What gives?

    After upgrading to Lion, Image Capture does not work, even though it is intel software.  Gives error 9931.  What gives?

    Ouch, if it is indeed damaged, then sadly you need to restore the whole danged huge OS!
    Didn't used to be this way before Lion/10.7.
    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.
    If that doesn't help Reinstall the OS.

  • How can I display images that are not included in any collection?

    How can I display images that are not included in any collection (some filter or smart collection)? A smart collection with parameters "Collection - contains - empty field" does not work. Lightroom 5.

    Thank you! Good idea! I ordered letters of the alphabet (space separated), and it works.

Maybe you are looking for

  • Alarm Tone, Media Card Issues

    Purchased Curve 9360 about a week ago. Had memory card in my old Blackberry which I transferred and was working fine. Tried to put in a new memory card (wanted more storage), transferred things onto it, everything fine. Tried to change alarm tone to

  • Iphone jack not working?

    has anyone have problems with the iphone audio jack? I had actually changed last week my Iphone 4S becuase I had  a bluetooth conections problems and the phone jack was not working ( only one side worked when I plugged my ears phones). With the new i

  • Barcode BC_CD39

    Hello Every, I am trying to copy the Barcode BC_CD39 to reduce the size of the Barcode. Can someone tell me how to do that. All the help is appreciated. Thanks, Sneha.

  • Problem connecting C3-01 to OVI Suite via USB

    I can't seem to successfully connect my C3-01 to the OVI Suite via USB. The PC (running Vista) sees the device, but OVI Suite keeps complaining that I need to change the USB mode on the device to OVI Suite, although that's how I set it.  OVI Suite al

  • Forms Error when trying to compile a 6i Form in 9i

    I have a form which is created in forms 6. Im trying to compile that form in 9 but it gives me a warning like below FRM-30457 Warning:Maximum length ignored for character datatype subordinate mirror item :ctl.descr What should i do to correct this?