Smooth image saling

Hi,
Iam developing an Image Viewer application using ImageIO package(as I have to handle Tiff files).
Iam trying to scale a b&w tif file which is scanned with 300 dpi(2400X3162) using Graphics2D.scale() method and the quality is really bad for any scale factor below 0.5.
I tried setting anti-aliasing to true and there is no change in appearence.
Is there any better way to do this? Like implementing any better algorithms etc.
I tried JTiffy viewer(http://www.tiffy.de) and the quality is excellent for the same file.
Any suggestions please?
varma

Thanks a lot DrLaszloJamf for you quick response.
It works perfect for scaleFactor <=1 and I am amazed by the qualty of the image.
But throws OutOfMemory error for scaleFactor > 1 (1.1 to 2..). Here is my code.
BufferedImage image = null;                         
int w=0;
int h=0;
try
     ImageInputStream in = ImageIO.createImageInputStream(new FileInputStream(path));
     String ext = path.substring(path.lastIndexOf(".") + 1);
     ext = ext.trim();
     Iterator readers = ImageIO.getImageReadersBySuffix(ext);
     if (!readers.hasNext())
     throw new IOException("no readers");
     ImageReader reader = (ImageReader) readers.next();
     reader.setInput(in);
     ImageReadParam param = reader.getDefaultReadParam();
     int total = reader.getNumImages(true);
     System.out.println("Total Pages= " + total);
     System.out.println("Loading...");
     try
          int num = Integer.parseInt(pageNum);
          w = reader.getWidth(num);
          h = reader.getHeight(num);
          image = reader.read(num);
          MediaTracker tracker = new MediaTracker(new JFrame());
          tracker.addImage(image, 0);
          tracker.waitForID(0);
          System.out.println("Successfully Loaded");
     catch(Exception e)
          System.out.println("Load Error: " + e);
     reader.abort();
     reader.dispose();
     image.flush();
     ColorModel cm = null;
     try {
          PixelGrabber grabby = new PixelGrabber(image, 0, 0, 1, 1, false);
          if (!grabby.grabPixels())
               throw new RuntimeException("pixel grab fails");
          cm = grabby.getColorModel();
     catch (InterruptedException e) {
          throw new RuntimeException("interrupted", e);
     double scaleFactor = 1;
     try
          scaleFactor = Double.parseDouble(scale);
     catch(Exception se)
          System.out.println("scale Error: " + se);
     int reqWidth = (int)(w*scaleFactor);
     int reqHeight = (int)(h*scaleFactor);
     Image target = null;
     if(scaleFactor < 1)
     target = image.getScaledInstance(reqWidth, reqHeight, Image.SCALE_AREA_AVERAGING);
     else
          int transparency = cm.getTransparency();
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
          GraphicsDevice gd = ge.getDefaultScreenDevice();
          GraphicsConfiguration gc = gd.getDefaultConfiguration();
          BufferedImage target2 = gc.createCompatibleImage(reqWidth, reqHeight);
          Graphics2D g = target2.createGraphics();
          double scalex = (double) target2.getWidth() / w;
          double scaley = (double) target2.getHeight() / h;
          AffineTransform at = AffineTransform.getScaleInstance(scalex, scaley);
          g.drawRenderedImage(image, at);
          g.dispose();
          target = target2;
Then, Iam using the target image to be rendered in JPanel.
I also used createVolatileImage method of GraphicsConfiguration. But ended up with the same OutOfMemory error.
Is there any way that I can get arround this error?
Thank you.
varma

Similar Messages

  • Smooth Image Blending

    How to create a Smooth Image Blend with Photoshop Touch
    Combine two photos seamlessly using a gradient within the Add Fade feature. You control where the fade starts and stops.
    1. After selecting the "Add Dramatic Flare" tutorial, press "Begin Tutorial" to start. Tap the top layer and choose Add Fade from the & menu.
    2. Drag the top gradient handle down to the middle of the image.
    3. Tap the Edit Gradient button. Adjust the fade opacity by dragging the gradient stops. Tap OK.
    4. Select the background layer and choose Adjustment > Color Balance
    5. To match the top layer's light quality, increase the Red value by about 10%. Tap OK.
    6. Tap the back arrow in the top options bar. This will prompt you to save. Press Save to save your project.
    Download the attachment to view this tutorial in a PDF form.
    Janelle

    Hi Michael,
    Could you please add some information about which platform/device you are on?
    I'm not sure if you are familiar with how to work with the tutorial, you need to follow the step and then press the "forward" button in order to continue with the next step.
    Is this the only tutorial you are experiencing issues with?
    I think it would help if you show us some kind of screen shot of what you are seeing/encountering. A screen shot about how the document looks like when the
    when opening the tutorial would probably be the best.
    thanks,
    Ignacio

  • Smooth image pan

    Sorry I'm a noob
    I import images into flash but when I use motion tween to pan
    them, they play all jerky, like 3 or 4 FPS. My timeline is set to
    24fps. The other animations play smoothly, its just the imported
    images that are jerky.
    I hear flash 8 can make it smooth but the file won’t be
    compatible with old flash players. A lot of people I know still
    haven’t upgraded. I would like to make it compatible with
    flash 7 or hopefully earlier.
    Any suggestions would be greatly appreciated.
    Thanks!

    Thanks Dave, really appreciate the time you've given to try and help me. Woke up to a stack of snow here in the UK - we're not used to the white stuff.
    I've tried rendering to 50 frames per sec and no difference in stuttering movement. I've been looking more closely at the RAM preview and although it runs in real time, there is a slight stutter in places (at 25 and 50 frames/s), although much smoother than the rendered pan, which is bad.  When compressed in Premier to H.264 it looks even worse.
    I've been searching the web for postings on this subject, and on this and other forums, the same question has been asked many times and I haven't found the situation resolved by the end of the thread - where some guy goes 'yeah thanks that's real smooth now'! Also, I've seen lots of smooth pans done with a camera on video clips but I can't find a smooth one done from a still image rendered by software.
    Cheers
    Steve

  • Photoshop CS4 new Smoother Image Viewing problem

    Photoshop CS4 now appears to make images look smoother than ever, however, when I'm working on images which have hard aliased edges, the images look blury and actually make me feel like my eyes are out of focus. It's very disconcerting. I've not found a way to preview the CS3 way so I've had to revert back to using CS3 at work. This problem represents a show stopper for me.

    I'm on the phone with HP tech support about this problem. He said he's gonna charge me to fix the problem and than he put me on hold. I'm waiting to find out how much money I've saved. You put some dollars in my pocket. Thanks!!!!!!

  • 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

  • BufferedImage displays as streaky; smooth image not produced

    Hi all,
    I have three classes that I'm working with. One is ImageProcessor, a Class I have to process images. Another is IMAQGUI, a GUI for my IMAQ service, and the third is IMAQIceStormService.
    In IMAQIceStormService, I am using ImageProcessor to create an image from a byte[] that gets sent to me, and I'm using IMAQGUI to display the image on my GUI.
    All this is working fine, except the image does not display properly. I am getting the proper data, as I have compared the camera image to my streaky image, and saw that they are the same. The width, height, depth, and stride should all be correct; 1000x1000 pixels, 8 bits per pixel, and a stride of 0. I recently changed my ImageProcessor code to make some methods static, and I may have broken something.
    Basically, can anyone take a look at my ImageProcessor methods, and possibly give any suggestions as to why the image is not displaying correctly?
    Here is the relevant part of IMAQIceStormService:
         public void imageAcquired(long id, IMAQTypes.ImageDesc imageDesc, byte[] imageData,
              Ice.Current current) {
              IMAQGUI.appendImage(ImageProcessor.createImage(imageData, imageDesc.width, imageDesc.height));
         }IMAQTypes.ImageDesc is simply the image description. It tells me the width, height, depth, and stride of the image. As you can see, I am telling IMAQGUI to appendImage based on what returns from ImageProcessor. First, here is the relevant code from IMAQGUI:
         private static JLabel imageViewer = new JLabel(); // this gets added to the main panel in a different method
         public static void appendImage(BufferedImage image) {
              imageViewer.setIcon(new ImageIcon(image));
              imageViewer.revalidate();
         }This just sets the icon to the new image, and revalidates the JLabel so it displays the new image.
    Finally, here is the most important part. This is the relevant code from ImageProcessor:
        public static BufferedImage toImage(byte[] data, int w, int h) {
            DataBuffer buffer = new DataBufferByte(data, data.length);
            WritableRaster raster = Raster.createInterleavedRaster(buffer, w, h, w,
            1, new int[] {
                0
            } , null);
            ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
            ColorModel cm = new ComponentColorModel(cs, false, true,
            Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
            return new BufferedImage(cm, raster, false, null);
        public static BufferedImage createImage(byte[] data, int width, int height) {
              BufferedImage im = toImage(data, width, height);
            //image = toImage(data, width, height);
            BufferedImage out = createRGBImage(im);
            return out;
        public static BufferedImage createRGBImage(BufferedImage in) {
            BufferedImage output = new BufferedImage(in.getWidth(), in.getHeight(), BufferedImage.TYPE_INT_RGB);
            Graphics2D g = output.createGraphics();
            g.drawRenderedImage(in, null);
            g.dispose();
            return output;
        }I am unsure of why ImageProcessor is creating a streaky image, especially because I know the image dimensions are correct. Is there something I am missing? Does anyone see any mistakes anywhere? Does anyone have any suggestions?
    I know this is a lot of information, so thanks a lot for any help you can provide.

    Hi again,
    I'm still unsure as to what the problem is here. I thought maybe it had something to do with the GUI container, but I saved the BufferedImage to the local filesystem using ImageIO.write(), and it looks the same.
    Although no one has apparently seen any obvious problems, can someone possibly let me know if the methods are correct for what I am trying to do: convert a byte[] to a BufferedImage of RGB format?

  • Smooth Images End Up Looking Jagged

    Hi! I'm new to FireWorks. When I export images, they look
    great in FireFox, but in IE, they look disastrously amateurish.
    Does anyone have any advice on making sure exported images look
    great in both FF and IE?
    Typically, I use anti-aliasing and avoid dithering.
    Thanks!

    romaneagle wrote:
    > Hi! I'm new to FireWorks. When I export images, they
    look great in FireFox, but
    > in IE, they look disastrously amateurish. Does anyone
    have any advice on making
    > sure exported images look great in both FF and IE?
    >
    > Typically, I use anti-aliasing and avoid dithering.
    >
    > Thanks!
    >
    Samples? Links to end results and PNG's are needed or we are
    only guessing.
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

  • I'm trying to play an .mp4 video, but it does not display smoothly; image is jumpy.  The sound is fine, but the image starts and stops.  When I play the same file in WMV, displays just fine.

    Any suggestions on what I can try to clear this up?  Videos that I have downloaded through iTunes work just fine.  I don't know how to troubleshoot this file to see what is causing the issue.

    bertjones00 wrote:
    It reads other DVD's just fine.  I've tried playing commercial DVD's and homemade movies and they all work just fine.  I'm also able to create and read data discs with no problem.   I'm only having trouble playing this one particular DVD movie.   I'm able to play the movie in my PS3 with no problem and can play it in a regular HDMI DVD player.   I'm not sure if my computer doesn't recognize the encoding for the movie or if I need to download another type of software to play the movie.  Someone suggested that i try using PowerDVD to see if it could play the movie. 
    Ok then tell me this what is that DVD your having problem watching then? And what Region Code are you from like Euro is Region 2 and so on??? Could be the Region problem on the DVD doesn't match your drive Region as well?
    I am a Volunteer to help others on here-not a HP employee.
    Replies aren't online 24/7 because of Time Zone differences.
    Remember in this Day and Age of Computing the Internet is Knowledge at your fingertips if you choose understand it. -2015-

  • How desactivate the smooth for jpg,gif images¿?

    Hi
    I need view the images pixelates...no smoothing...
    because in others computers with out Geforce card, show pixelate.
    Driver 4403
    Windows XP
    How desactivate the smooth images¿?...

    Sorry...my english is terrible
    i zoom in the image but the video card smooth the image...and i cant see the real state of the image...if stay pixelate or not...always smooth....how desactivate this option in my video card

  • Want to smooth loaded images (jpg) in flash8

    i want to smooth loaded images (jpg) in flash8
    let's say that i have one layer, one frame and the following
    AS:
    _root.loadMovie("q.jpg");
    the _root could be an object, but the behavior is the same
    so in flash7 CTRL+ENTER, right click and zoom ---> RESULT:
    zoom with image interpolation (like photoshop bicubic resample)
    but in flash8 CTRL+ENTER, right click and zoom --->
    RESULT: zoom with NO image interpolation (like photoshop nearest
    nei ghbor resample)
    why?????
    i have looked in help but all i can find is somthing refering
    about images in the library. I want external jpgs!!!
    i have done a slideshow with setable tranzitions (fade, blur,
    moving, zoom in/out, external loaded masking)
    here is some the important part of the my code (not important
    for my problem, but I just want to say that i've worked about 1-2
    days and i want to make it better. is frustating that i have blur,
    fade, gradient transparency (blending) and not a smooth image):
    Gtime=getTimer(); //global timmer
    ///////////////////////////////ia datele generale, daca cele
    particulare lipsesk
    /*Ttrans=eval("q.tt")-0;*/
    if(eval("q.tt"+pidx))Ttrans=eval("q.tt"+pidx)-0;
    /*Tfoto=eval("q.tf")-0;*/
    if(eval("q.tf"+pidx))Tfoto=eval("q.tf"+pidx)-0;
    /*sv=eval("q.sv")-0;*/
    if(eval("q.sv"+pidx))sv=eval("q.sv"+pidx)-0;
    /*sk=eval("q.sk")-0;*/
    if(eval("q.sk"+pidx))sk=eval("q.sk"+pidx)-0;
    /*xv=eval("q.xv")-0;*/
    if(eval("q.xv"+pidx))xv=eval("q.xv"+pidx)-0;
    /*yv=eval("q.yv")-0;*/
    if(eval("q.yv"+pidx))yv=eval("q.yv"+pidx)-0;
    /*xk=eval("q.xk")-0;*/
    if(eval("q.xk"+pidx))xk=eval("q.xk"+pidx)-0;
    /*yk=eval("q.yk")-0;*/
    if(eval("q.yk"+pidx))yk=eval("q.yk"+pidx)-0;
    /*rv=eval("q.rv")-0;*/
    if(eval("q.rv"+pidx))rv=eval("q.rv"+pidx)-0;
    /*rk=eval("q.rk")-0;*/
    if(eval("q.rk"+pidx))rk=eval("q.rk"+pidx)-0;
    /*xbk=eval("q.xbk")-0;*/
    if(eval("q.xbk"+pidx))xbk=eval("q.xbk"+pidx)-0;
    /*ybk=eval("q.ybk")-0;*/
    if(eval("q.ybk"+pidx))ybk=eval("q.ybk"+pidx)-0;
    /*xbv=eval("q.xbv")-0;*/
    if(eval("q.xbv"+pidx))xbv=eval("q.xbv"+pidx)-0;
    /*ybv=eval("q.ybv")-0;*/
    if(eval("q.ybv"+pidx))ybv=eval("q.ybv"+pidx)-0;
    /*mask=eval("q.mask");*/
    if(eval("q.mask"+pidx))mask=eval("q.mask"+pidx);
    if(trans==0 && Gtime>Ftime+Tfoto*1000){
    //retain values
    aux2=(Gtime-Ttime)*100/((Ttrans*2+Tfoto)*1000);
    Ttrans2=Ttrans;
    Tfoto2=Ttrans;
    sv2=sv;sk2=sk;
    xv2=xv;yv2=yv;
    xk2=xk;yk2=yk;
    rv2=rv;rk2=rk;
    xbv2=xbv;ybv2=ybv;
    xbk2=xbk;ybk2=ybk;
    //end retain values
    Ttime=Gtime;
    trans=1;//transition
    if(p=="p1"){
    p="p2";pp="p1";
    }else{
    p="p1";pp="p2";
    pidx++;
    if(eval("q.p"+pidx)==undefined){
    end=1;
    //gotoAndStop(6);
    }else{
    p1.swapDepths(p2);
    loadMovie(fotofolder+eval("q.p"+pidx),eval(p+".p.p"));
    eval(p)._xscale=eval(p)._yscale=100;
    eval(p)._rotation=0;
    if(trans==1 && Gtime>Ttime+Ttrans*1000){
    Ftime=Gtime;
    trans=0;//not transition
    //tranzition
    if(trans==1){
    if(mask.length>3)
    eval(p)._alpha=100;
    else
    eval(p)._alpha=(Gtime-Ttime)*100/(Ttrans*1000);
    aux=(Gtime-Ttime)*100/((Ttrans*2+Tfoto)*1000)
    eval(p)._x=xv*aux+xk;
    eval(p)._y=yv*aux+yk;
    eval(p)._xscale=eval(p)._yscale=sv*aux+100+sk;
    eval(p)._rotation=rv*aux+rk;
    blur.blurX=aux*xbv+xbk;
    blur.blurY=aux*ybv+ybk;
    eval(p).p.p.filters = [blur];
    //intarzierea
    aux=aux+aux2;
    eval(pp)._x=xv2*aux+xk2;
    eval(pp)._y=yv2*aux+yk2;
    eval(pp)._xscale=eval(pp)._yscale=sv2*aux+100+sk2;
    eval(pp)._rotation=rv2*aux+rk2;
    if(!end)gotoAndPlay(_currentframe-1);
    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////

    See
    http://www.kaourantin.net/2005/12/dynamically-loading-bitmaps-with.html
    danredman wrote:
    > i want to smooth loaded images (jpg) in flash8
    >
    > let's say that i have one layer, one frame and the
    following AS:
    >
    _root.loadMovie("q.jpg");
    >
    > the _root could be an object, but the behavior is the
    same
    >
    > so in flash7 CTRL+ENTER, right click and zoom --->
    RESULT: zoom with image
    > interpolation (like photoshop bicubic resample)
    > but in flash8 CTRL+ENTER, right click and zoom --->
    RESULT: zoom with NO image
    > interpolation (like photoshop nearest nei ghbor
    resample)
    >
    > why?????
    >
    > i have looked in help but all i can find is somthing
    refering about images in
    > the library. I want external jpgs!!!
    > i have done a slideshow with setable tranzitions (fade,
    blur, moving, zoom
    > in/out, external loaded masking)
    >
    >
    > here is some the important part of the my code:
    >
    > Gtime=getTimer(); //global timmer
    >
    > ///////////////////////////////ia datele generale, daca
    cele particulare
    > lipsesk
    > /*Ttrans=eval("q.tt")-0;*/
    if(eval("q.tt"+pidx))Ttrans=eval("q.tt"+pidx)-0;
    > /*Tfoto=eval("q.tf")-0;*/
    if(eval("q.tf"+pidx))Tfoto=eval("q.tf"+pidx)-0;
    > /*sv=eval("q.sv")-0;*/
    if(eval("q.sv"+pidx))sv=eval("q.sv"+pidx)-0;
    > /*sk=eval("q.sk")-0;*/
    if(eval("q.sk"+pidx))sk=eval("q.sk"+pidx)-0;
    > /*xv=eval("q.xv")-0;*/
    if(eval("q.xv"+pidx))xv=eval("q.xv"+pidx)-0;
    > /*yv=eval("q.yv")-0;*/
    if(eval("q.yv"+pidx))yv=eval("q.yv"+pidx)-0;
    > /*xk=eval("q.xk")-0;*/
    if(eval("q.xk"+pidx))xk=eval("q.xk"+pidx)-0;
    > /*yk=eval("q.yk")-0;*/
    if(eval("q.yk"+pidx))yk=eval("q.yk"+pidx)-0;
    > /*rv=eval("q.rv")-0;*/
    if(eval("q.rv"+pidx))rv=eval("q.rv"+pidx)-0;
    > /*rk=eval("q.rk")-0;*/
    if(eval("q.rk"+pidx))rk=eval("q.rk"+pidx)-0;
    > /*xbk=eval("q.xbk")-0;*/
    if(eval("q.xbk"+pidx))xbk=eval("q.xbk"+pidx)-0;
    > /*ybk=eval("q.ybk")-0;*/
    if(eval("q.ybk"+pidx))ybk=eval("q.ybk"+pidx)-0;
    > /*xbv=eval("q.xbv")-0;*/
    if(eval("q.xbv"+pidx))xbv=eval("q.xbv"+pidx)-0;
    > /*ybv=eval("q.ybv")-0;*/
    if(eval("q.ybv"+pidx))ybv=eval("q.ybv"+pidx)-0;
    > /*mask=eval("q.mask");*/
    if(eval("q.mask"+pidx))mask=eval("q.mask"+pidx);
    >
    >
    > /
    >
    >
    > if(trans==0 && Gtime>Ftime+Tfoto*1000){
    > //retain values
    > aux2=(Gtime-Ttime)*100/((Ttrans*2+Tfoto)*1000);
    > Ttrans2=Ttrans;
    > Tfoto2=Ttrans;
    > sv2=sv;sk2=sk;
    > xv2=xv;yv2=yv;
    > xk2=xk;yk2=yk;
    > rv2=rv;rk2=rk;
    > xbv2=xbv;ybv2=ybv;
    > xbk2=xbk;ybk2=ybk;
    > //end retain values
    > Ttime=Gtime;
    > trans=1;//transition
    >
    > if(p=="p1"){
    > p="p2";pp="p1";
    > }else{
    > p="p1";pp="p2";
    > }
    > pidx++;
    > if(eval("q.p"+pidx)==undefined){
    > end=1;
    > //gotoAndStop(6);
    > }else{
    > p1.swapDepths(p2);
    > loadMovie(fotofolder+eval("q.p"+pidx),eval(p+".p.p"));
    > eval(p)._xscale=eval(p)._yscale=100;
    > eval(p)._rotation=0;
    > }
    > }
    > if(trans==1 && Gtime>Ttime+Ttrans*1000){
    > Ftime=Gtime;
    > trans=0;//not transition
    > }
    > //tranzition
    >
    > if(trans==1){
    > if(mask.length>3)
    > eval(p)._alpha=100;
    > else
    > eval(p)._alpha=(Gtime-Ttime)*100/(Ttrans*1000);
    > }
    > aux=(Gtime-Ttime)*100/((Ttrans*2+Tfoto)*1000)
    > eval(p)._x=xv*aux+xk;
    > eval(p)._y=yv*aux+yk;
    > eval(p)._xscale=eval(p)._yscale=sv*aux+100+sk;
    > eval(p)._rotation=rv*aux+rk;
    > blur.blurX=aux*xbv+xbk;
    > blur.blurY=aux*ybv+ybk;
    > eval(p).p.p.filters = [blur];
    > //intarzierea
    > aux=aux+aux2;
    > eval(pp)._x=xv2*aux+xk2;
    > eval(pp)._y=yv2*aux+yk2;
    > eval(pp)._xscale=eval(pp)._yscale=sv2*aux+100+sk2;
    > eval(pp)._rotation=rv2*aux+rk2;
    >
    > if(!end)gotoAndPlay(_currentframe-1);
    >

  • Smooth jpeg images

    Hi
    I wonder if I can smooth images that I work with in some way before saving them. This is the code that I use now but my images look a bit too sharp:
    Graphics2D g = Slikavenvelika.createGraphics();
    g.drawImage(Slikanot, pret3, null);
    g.dispose();
    OutputStream datoteka = new FileOutputStream(mapa + "/" + "Velike/" + slika);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(datoteka);
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(Slikavenvelika);
    param.setQuality(0.85f, true);
    encoder.encode(Slikavenvelika, param);
    datoteka.close();
    Thanks for answering
    Gregor

    Hi
    I already figured out a way:
    float kol = 1.0f/9.0f;                                                       //Tukaj se ustvari matrika za transformacijo
              float[] elementi = new float[9];
              for (int i = 0; i < 9; i++)
              elementi[i] = kol;
              Kernel jedromehcanja = new Kernel(3, 3, elementi);
              ConvolveOp mehcaj = new ConvolveOp(jedromehcanja);                         //Tukaj se izvr&#353;i operacija transformacije glede na matriko
              mehcaj.filter(zmehcana, ostra);
    This above filter blurs my images, and if I wanted to blur them even more, I would just have to use a bigger kernel. I get that much.
    But the thing is that I don't want my images blurred so much as this filter does. Is there any other way or kernel for above process that would smooth/blurr my iamges just a little bit?
    Thanks for answering
    Gregor

  • Trying to export html to dreamweaver but save images as pngs.

    I'm designing a floating site.  My workflow is PS=====>Fireworks====>Dreamweaver.  I made a navbar in FW with a transparent background and exported html to dreamweaver.  I inserted the fireworks htm, put it online and it looks terrible.  You can see it here:
    http://www.njtraininggrounds.com/thirddaydesign.com/identity.html
    Don't worry about the portfolio button, I know what's going on there.  But I can't figure out why there is "stairstepping" on the logo and on all the navbar buttons.  This is the first time I've ever created a floating site.  I just put a jpeg for repeat using the dreamweaver css, and then inserted the rest in a table. I got some good replies in dreamweaver forums, but they all centered around saving the images when you export as pngs or as transparent gifs with a green matt.  How can I do this with fireworks cs3?
    Could anyone give me an idea of what I'm doing wrong?  Thanks so much.
    Wil

    The GIF format supports only one value of transparency. Your text, when anti-aliased against whatever background in Fireworks (transparent?), probably looks fine. When you export, though, you lose the smooth transition. (If you zoom in, you can see the blending of text to background and that's what you're losing.)
    You have two options.
    You can still use the GIF format. Just pick a green value out of your background image and use that for your canvas. Then, when you export, set that color to transparent. Where the pixels of the text and that color blend for the anti-aliasing, you'll have opaque pixels, but they'll look all right against your background image.
    Use a PNG8, which is an indexed palette like the GIF, but it supports semi-transparent colors. When you go to export, you may want to add more colors using the eye dropper tool, as FW doesn't quite pick out all the values it might for a smooth image. See this article:
    http://blogs.sitepoint.com/2007/09/18/png8-the-clear-winner/
    (I like exporting through File>Image Preview, myself.)

  • Font Smoothing GONE--Help!!!

    I'm running 10.6.2, and I pretty much have ZERO font smoothing whenever I ctrl-mouse zoom on any menu, any text, any program. This is on my MacBook Pro (2 years old) that had perfect font smoothing in Leopard.
    I've turned off the CRT checkbox in System Preferences—doesn't help
    I've used Terminal to run defaults -currentHost write -globalDomain AppleFontSmoothing -int 1 and also tried 2 and 3 and even reverting to defaults—doesn't help
    I've used Font Book to validate fonts and remove duplicates (especially after Office 2004 install)—doesn't help
    I've also rebooted after all these operations—still almost zilch smoothing on zoom
    Even Finder looks AWFUL
    Help! My MBP looks like crap now!

    That sounds good. A lot of tests to run! Hate to do the new user test, but will if I have to.
    I am really leaning toward the Option-Command-"\" having (unintentionally) turned OFF Screen Zoom (under mouse or trackpad) Image Smoothing.
    How could it take me so long to learn that there is Font Smoothing, and there is Image Smoothing. TWO DIFFERENT THINGS.
    The Chain of Blame here is so convoluted it hurts my brain.
    1. Evernote was trying to reinstall web clipping and/or its Safari plug-in ever since I converted to Snow Leopard. (Massive evidence of this in Console error messages, and they are hilarious: "Can't get Elephant!" and "Can't install icon!" over and over and over again. Just give it up, Evernote!)
    2. So one day Evernote's interference with Safari messes up my executing the Option-Command-"\" command to log into my bank (it's normally a 1Password keyboard shortcut that works great in Safari).
    3. Option-Command-"\" reverts back to its "normal" designation (turn on/off Screen Zoom (under mouse or trackpad) Image Smoothing).
    4. I hit Option-Command-"\" repeatedly, trying to get the 1Password HUD to pop up in Safari. It doesn't.
    5. By hitting Option-Command-"\" so many times, I unintentionally turn off Screen Zoom Image Smoothing. Only I don't realize it.
    If this theory IS correct, then it's a simple fix!
    The lesson learned would be:
    System Preferences, Personal, Appearance, Font Smoothing
    is a DIFFERENT preference from
    System Preferences, Mouse/Trackpad, (Two Fingers), Screen Zoom, Options, Smooth Images
    Of course, I'll report back just as soon as my SuperDuper backup finishes and I can try this test.
    And if this IS the problem, well, I blame it on the elephant.

  • Inserting image in to database !!

    Hi All,
    I have to insert image in to the database. My image is there in swing object Image. Is there any way to insert that image in to the database.
    Any body having knowledge on this, Please help.
    Thanks in advance.
    Regards,
    Roja.

    Hi
    Take a look to this code I found surfing, it creates an image from url then resize it and return it as byte array that you can use to set a blob in the database:
    public static byte [] resizeImage(URL url,int widthConstraint,int heightConstraint) throws ImageFormatException, IOException
         ImageIcon imageIcon = new ImageIcon(url);
         Image img = imageIcon.getImage();
         int imgWidth = imageIcon.getIconWidth();
         int imgHeight = imageIcon.getIconHeight();
         ImageIcon adjustedImg=null;
         if ( imgWidth>0 && imgHeight>0)//imgWidth > widthConstraint | imgHeight >  heightConstraint )
         if ( imgWidth > imgHeight )
           // Create a resizing ratio.
           double ratio = (double) imgWidth / (double)
            widthConstraint;
           int newHeight = (int) ( (double) imgHeight / ratio );
           // use Image.getScaledInstance( w, h,
           // constant), where constant is a constant
           // pulled from the Image class indicating how
           // process the image; smooth image, fast
           // processing, etc.
           adjustedImg = new ImageIcon(
            imageIcon.getImage().getScaledInstance(
              widthConstraint, newHeight,
              Image.SCALE_SMOOTH )
         else
           // Create a resizing ratio.
           double ratio = (double) imgHeight / (double)
            heightConstraint;
           int newWidth = (int) ( (double) imgWidth / ratio );
           adjustedImg = new ImageIcon(
           imageIcon.getImage().getScaledInstance( newWidth,
              heightConstraint, Image.SCALE_SMOOTH )
         int resizeWidth = adjustedImg.getIconWidth();
         int resizeHeight = adjustedImg.getIconHeight();
         Panel p = new Panel();
         BufferedImage bi = new BufferedImage(resizeWidth, resizeHeight,
         BufferedImage.TYPE_INT_RGB);
         Graphics2D big = bi.createGraphics();
         big.drawImage(adjustedImg.getImage(), 0, 0, p);
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
         encoder.encode(bi);
         byte[] byteArray = os.toByteArray();
         return byteArray;
      else
      return new byte[0];
       }hope this helps.

  • Creating PDF from PowerPoint results in lines around images

    I've researched this topic on the forums and have seen some related posts but none that directly hit the issue I'm having. Have a PP file with some images and when I create PDF, the resulting file shows random "outline" lines partially around some of the images.  These lines do not show up when printing.  They go away if I uncheck the "Smooth Images" box under Edit/Preferences/Page Display.  However, unchecking the box degrades the image quality and requires the viewer to make this change in his version of Reader.  This PDF will be viewed typically on a screen rather than via print and I can't rely on the user to do the Smooth Images change.  I have spent lots of hours trying various potential fixes (differing file types, etc.) but can't figure it out and haven't been able to find a solution anywhere on the web.  Anyone up for the challenge of helping me figure it out?

    Any chance you can post a link to the file or PDF page?

Maybe you are looking for