Picking a color of a JPEG image

Hi!
Can anyone please help me with this issue:
I'm writing a program that has to *"pick a color" of a 640 x 480px JPEG image*. The arguments of the program are the X and Y coordinates from the top left corner - than the program outputs the color in the hexadecimal notation.
Kind regards

Nope not a homework problem ... I have a GUI program (some input fields and a simple display) that downloads some specific measurement pictures (colour graphs) from a daily refreshed site and it archives them in a specific order. The output of the program is a HTML file that resembles a specific measurement based on the colour of a specific pixel on these pictures.
I have everything in place ... just this colour picking of an image poses a halt for me.
That's why I was hoping to get a usage example of the method that you specified.
Edited by: Serpentinsek on Sep 24, 2008 10:48 AM

Similar Messages

  • How to set color space to JPEG image with Java advance Imaging

    How to set color space to JPEG image with Java advance Imaging.
    is there any API in JAI which support to set color space.

    I'm definately no guru, but this is how you can change it.
    CTRL + ALT + Click on the part of the component that you want to change. This brings up the Hidden Dom Inspector, background of component will be surrounded with a red outline (Make sure the red outline is surrounding the part of the tabset you want to change), Now you go to properties sheet and click the ellipses next to rules property this will pop up a dialog you look in this list (At the top) to see the default style classes that are affecting the rendering of the component outlined in red. (You will be able to select different sections of a single component) then you just rewrite the style class that you want to change in your Stylesheet (You will not find the styleclass that you want to change because it is a part of your theme .jar but as long as you name it exactly the same and place in your stylesheet it will override the theme .jar style classes) it's actually very easy -- you were right should be a piece of cake for a guru. Don't have the link handy but you can check out Winston's Blog on changing Table Formatting to get this information...It is EXTREMELY useful if you want your apps to have a custom look and not default that comes with Creator Themes.
    Hope this helps you out God knows others have helped me alot!
    Jason

  • Lightroom color cast question of JPEG image

    Lightroom color cast question of JPEG image
    Camera Canon MKII Color Matrix Adobe RGB
    Photoshop CS Color Setting Adobe RGB (1998)
    Lightroom 1.2 as new lightroom user I did not think that I needed to choose a color setting or color profile until I am ready to print my photos. I have not done any preset camera calibration.
    Link to my website with example photo http://www.basecampphotos.com/color.jpg
    My question is why is Lightroom displaying the images with a yellow color cast ? The image is a print screen from Lightroom on the left and Photoshop on the right The color cast problem can be seen in the white walls of the stairway. Also when viewing the image with Windows Picture and Fax viewer the walls are white as expected.
    Any ideas or suggestions as to why Lightroom is displaying the images with the yellow color cast or what I need to do to correct the issue ?
    Thanks
    Jim

    Almost definitely a corrupt monitor profile. Time and again this turns out to be the cause of such differences between PS and LR. You need to recalibrate the monitor or if you do not have a hardware calibrator, delete the profile from windows' monitor properties pane to test and then get a hardware calibrator.
    P.S since you are using adobeRGB jpegs, Windows picture and Fax viewers cannot give you the correct colors even on a calibrated monitor. Those are not color managed programs (I believe picture viewer finally is in Vista but definitely not in XP which you appear to be using). Also, PS has to be correctly set up to always preserve embedded profiles and to ask when you have profile mismatches, otherwise even PS will give incorrect color. Make sure to set this up in Edit>Color settings.
    P.S.2: Make sure you are not applying defaults in Lightroom to your images either on import or elsewhere. Sometimes people by accident define develop defaults that in this case might contain a white balance shift. Go to LR preferences and open the Presets tab. Here click on "Reset all default Develop settings" and make sure that only the auto grayscale checkbox is ticked. For images that it might have already happened to, make sure to hit the reset button.

  • Jpeg images and color gamuts

    When I make a jpeg image in my camera, it is assigned the adobe rgb gamut.
    What happens when it is imported in LR? Does the gamut change to prophoto automatically?
    When I print the jpeg do I have to specify the color gamut? If it isn't prophoto rgb, there is no place to specify the gamut?
    Can anyone explain?
    Andy

    Yes it is. You might want to read up in the manual about still importing and also about audio sampling rates.

  • Firefox 3.6.8 causing all JPEG images to be compressed like AOL 9.0

    System Setup:
    Windows 7 Home Premium x64
    NVIDIA GeForce 9500 GT (newest drivers installed)
    Aero is running, switched it off to troubleshoot. Problem persisted.
    Steps to Create the Problem:
    1.) Updated to 3.6.8 from 3.5.11.
    2.) Loaded up my website: http://www.columbuswebseo.com
    3.) I noticed that the background image looks compressed (where it has a gradient around the blurred light specks in top right corner) . Like a highly compressed JPEG image from AOL days (to speed up page load times).
    4.) Messed with all FireFox, Windows 7, NVIDIA, physical Dell LCD monitor color settings. Even did research on my RoadRunner connection to see if they implemented an accelerator of some sort. Disabled Add-ons one by one re-testing the issue along the way. Problem persisted.

    It's not your graphics card. It's not your OS. It's not your browser.
    It's your internet. I had a broadband card, and I figured out that my ISP (Internet Service Provider) was actually downgrading my image quality to make my internet faster. It's called Network Optimization. Look in the options menu of your broadband connection application (Like if you have T-Mobile or whatever, look in the part the application that connects you to the internet) and see if you can change your Optimization Settings. This should clear things up for you.
    Also, if your internet is really that slow, like mine was, I would suggest getting another provider. It's the best option. Hope that helps. :)

  • Is there a way to overlay a soundcloud music player widget (flash or HTML5) ON TOP of a jpeg image?

    I am designing my first webpage for a new site. It is very basic in function, where I am going to be embedding a bunch of soundcloud.com players of my music to my website. This part is fairly easy. I currently have Adobe Dreamweaver CS6.
    Since I have ZERO webdesign experience, going the easy route is best. It was suggested to me by someone to create what I wanted my webpage to look like in photoshop (which I have lots of experience in). Essentially, I have a single image with lots of visual information on it, where I can then add "hotspots" if needed. So, I created my design, where there are specific areas ON TOP of the jpeg image where I want to overlay the soundcloud player. I am able to adjust the size, and format (HTML5 or Flash) of the player itself at soundcloud. I then have the proper code that needs to be put where I want it on top of my image.
    Is there a simple piece of code, or a way in Dreamweaver to accomplish this in an easy way?
    Thanks in advance!

    Here is the widget code for HTML5 for the first one:
    <iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F63420632&c olor=c51c64&auto_play=false&show_artwork=false"></iframe>
    Flash if needed:
    <object height="81" width="100%"><param name="movie" value="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F63 420632&color=c51c64&auto_play=false&show_artwork=false&show_playcount=true&show_comments=t rue"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" src="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F63 420632&color=c51c64&auto_play=false&show_artwork=false&show_playcount=true&show_comments=t rue" type="application/x-shockwave-flash" width="100%" height="81"></embed></object><span><a href="http://soundcloud.com/groovefunkel/the-human-league-vs-elo-vs">The Human League vs. ELO vs. Lady Gaga - Don't You Want Me Evil This Way</a> by <a href="http://soundcloud.com/groovefunkel">groovefunkel</a></span>
    Second one: (HTML5)
    <iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F57922474&c olor=c51c64&auto_play=false&show_artwork=false"></iframe>
    Flash:
    <object height="81" width="100%"><param name="movie" value="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F57 922474&color=c51c64&auto_play=false&show_artwork=false&show_playcount=true&show_comments=t rue"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" src="https://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F57 922474&color=c51c64&auto_play=false&show_artwork=false&show_playcount=true&show_comments=t rue" type="application/x-shockwave-flash" width="100%" height="81"></embed></object><span><a href="http://soundcloud.com/groovefunkel/adele-vs-hall-and-oates-1">Adele vs. Hall and Oates - Maneater Won't Go</a> by <a href="http://soundcloud.com/groovefunkel">groovefunkel</a></span>
    And finally, here is a link to the jpeg image:
    http://www.mediafire.com/view/?z2bngmtiikmi9k9  (only 2mb files were permitted to be uploaded here directly)
    You can probably see where I want the player to overlay...below the text and to the right of the artwork.  I will have the image centered on the screen.
    I greatly appreciate your help!
    Thanks again,
    David

  • Imported JPEG images are too light

    Imported JPEG images appear lighter/brighter than the scanned image.
    How can I make JPEG images appear with the correct lightness/brightness so they look like the actual book or magazine from which they were scanned?
    Using Apple's "Preview" to look at a JPEG- everything looks fine. But when a JPEG is imported into Motion 4.0.3 (and/or Final Cut Pro 7.0.3), the image appears lighter/brighter, as if it's washed out. To see if this is just the way a JPEG appears in Motion and not how the finished product will be, I exported a Motion project with one or more JPEGs as a QuickTime movie. The QuickTime movie does not bring the JPEG image(s) back to the "correct" lightness/brightness as the scanned image.
    Settings used:
    JPEG image, using a CanoScan LiDE 210 scanner, Color Space: RGB, Color Profile: sRGB IEC61966-2.1, current Monitor Gamma setting on the scanner is set to 1.80
    How can I make JPEG images appear in Motion (and Final Cut Pro) so they are true to the source from which they were scanned?

    Does it do the same thing when you use TIFFs?
    Patrick

  • How can I load a CMYK jpeg image

    How can I load a CMYK jpeg image (originally saved from Photoshop) and then
    turn it into an rgb BufferedImage, in order to display it on screen in an
    applet?
    I first tried ImageIO.read(), but that does not work for cmyk jpegs. I then
    looked into the com.sun.image.codec.jpeg package, and tried methods like
    decodeAsBufferedImage() and decodeAsRaster().
    The first one (decodeAsBufferedImage) returned an image, but it seems that
    it was interpreted as an ARGB, and the colors were incorrect.
    I then read the documentation which (amongst many other things) stated that
    "If the user needs better control over conversion, the user must request the
    data as a Raster and handle the conversion of the image data themselves."
    This made sense, so I took to decodeAsRaster(), only to find that I could
    not figure out how to carry out the desired conversion.
    Of course, I have looked into the documentation for BufferedImage, Raster,
    ColorModel, ColorSpace etc, but after a while I was lost. (Before I got lost
    I read that you can convert images with the help of methods like toRGB,
    toCIEXYZ.)
    I have a feeling that this is probably pretty simple if you just know how to
    do it, but I sure would need some directions here.
    Any help would be appreciated. Thanks.

    You can either use the "Place" command from the main menu, under "File", or you can just open it, select the move tool "V", the click in the image and drag it to the other file's tab.

  • When inserting a .pdf of a document with a standard white paper color the test and images show up, but the white background is transparent. How do you also make the white paper color show up?

    When inserting a .pdf of a document into a Keynote template with a standard white paper color the text and images show up, but the white background is transparent. How do you also make the white paper color show up?

    Use the color fill option - select the inserted .pdf and assign a fill color of white to it using the Color Fill Menu on the Toolbar or the Color Picker Palette.
    Good Luck.

  • Problem displaying CMYK jpeg images

    I have a problem with a CMYK jpeg image.
    I know that about supported JPEGs in JRE - JCS_CMYK and JCS_YCCK are not supported directly.
    And I found here how to load the image:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4799903
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5100094
    I used both the suggestions described to load it, but when the image is displayed the colors are wrong, are very different from the one displayed in PhotoShop, for example.
    Any suggestion are very appreciated. If it's necessary i can send you the image.
    Roberto
    Here is the code
    package com.cesarer.example.crop;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.ImageInputStream;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class CroppingRaster extends JPanel
        BufferedImage image;
        Dimension size;
        Rectangle clip;
        boolean showClip;
        public CroppingRaster(BufferedImage image)
            this.image = image;
            size = new Dimension(image.getWidth(), image.getHeight());
            showClip = false;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int x = (getWidth() - size.width)/2;
            int y = (getHeight() - size.height)/2;
            g2.drawImage(image, x, y, this);
            if(showClip)
                if(clip == null)
                    createClip();
                g2.setPaint(Color.red);
                g2.draw(clip);
        public void setClip(int x, int y)
            // keep clip within raster
            int x0 = (getWidth() - size.width)/2;
            int y0 = (getHeight() - size.height)/2;
            if(x < x0 || x + clip.width  > x0 + size.width ||
               y < y0 || y + clip.height > y0 + size.height)
                return;
            clip.setLocation(x, y);
            repaint();
        public Dimension getPreferredSize()
            return size;
        private void createClip()
            clip = new Rectangle(140, 140);
            clip.x = (getWidth() - clip.width)/2;
            clip.y = (getHeight() - clip.height)/2;
        private void clipImage()
            BufferedImage clipped = null;
            try
                int w = clip.width;
                int h = clip.height;
                int x0 = (getWidth()  - size.width)/2;
                int y0 = (getHeight() - size.height)/2;
                int x = clip.x - x0;
                int y = clip.y - y0;
                clipped = image.getSubimage(x, y, w, h);
            catch(RasterFormatException rfe)
                System.out.println("raster format error: " + rfe.getMessage());
                return;
            JLabel label = new JLabel(new ImageIcon(clipped));
            JOptionPane.showMessageDialog(this, label, "clipped image",
                                          JOptionPane.PLAIN_MESSAGE);
        private JPanel getUIPanel()
            final JCheckBox clipBox = new JCheckBox("show clip", showClip);
            clipBox.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    showClip = clipBox.isSelected();
                    repaint();
            JButton clip = new JButton("clip image");
            clip.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    clipImage();
            JPanel panel = new JPanel();
            panel.add(clipBox);
            panel.add(clip);
            return panel;
        public static void main(String[] args) throws IOException
             File file = new File("src/ABWRACK_4C.jpg");
             // Find a JPEG reader which supports reading Rasters.
            Iterator readers = ImageIO.getImageReadersByFormatName("JPEG");
            ImageReader reader = null;
            while(readers.hasNext()) {
                reader = (ImageReader)readers.next();
                if(reader.canReadRaster()) {
                    break;
         // Set the input.
            ImageInputStream input =
                ImageIO.createImageInputStream(file);
            reader.setInput(input);
            Raster raster = reader.readRaster(0, null);
             BufferedImage bi = new BufferedImage(raster.getWidth(),
                    raster.getHeight(),
                    BufferedImage.TYPE_4BYTE_ABGR);
             // Set the image data.
             bi.getRaster().setRect(raster);
            // Cropping test = new Cropping(ImageIO.read(file));
             CroppingRaster test = new CroppingRaster(bi);
            ClipMoverRaster mover = new ClipMoverRaster(test);
            test.addMouseListener(mover);
            test.addMouseMotionListener(mover);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new JScrollPane(test));
            f.getContentPane().add(test.getUIPanel(), "South");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class ClipMoverRaster extends MouseInputAdapter
        CroppingRaster cropping;
        Point offset;
        boolean dragging;
        public ClipMoverRaster(CroppingRaster c)
            cropping = c;
            offset = new Point();
            dragging = false;
        public void mousePressed(MouseEvent e)
            Point p = e.getPoint();
            if(cropping.clip.contains(p))
                offset.x = p.x - cropping.clip.x;
                offset.y = p.y - cropping.clip.y;
                dragging = true;
        public void mouseReleased(MouseEvent e)
            dragging = false;
        public void mouseDragged(MouseEvent e)
            if(dragging)
                int x = e.getX() - offset.x;
                int y = e.getY() - offset.y;
                cropping.setClip(x, y);
    }

    The loading process It takes about 10 seconds, and every repaint it takes the same time.The painting yes, the loading no. It shouldn't take much more time to load the image then an ordinary JPEG. In particular, your now using a "natively accelerated" JPEG image reader, so it should take less time on average to load any JPEG. 10 seconds is absurd. Are you sure your not including the drawing time in that figure?
    - Another problem: JAI-ImageIO is not available for MAC OS X platform.This is somewhat true. You can take the imageio.jar file and package it together with your program (adding it to the class path). This will give you most of the functionality of JAI-ImageIO; in particular the TIFFImageReader. You just won't be able to use the two natively accelerated ImageReaders that comes with installing.
    Right now, you're using the accelerated CLibJPEGImageReader to read the image. You can't use this image reader on the MAC, so you have to take the approach mentioned in the 2nd bug report you originally posted (i.e. use an arbitrary CMYK profile).
    The conversion is too long more than 30 seconds.The code you posted could be simplified to
    BufferedImage rgbImage = new BufferedImage(w,h,
                BufferedImage.3_BYTE_BGR);
    ColorConvertOp op = new ColorConvertOp(null);
    op.filter(cmykImage,rgbImage);But again, 30 seconds is an absurd value. After a little preparation, converting from one ICC_Profile to another is essentially a look up operation. What does,
    System.out.println(cmykImage.getColorModel().getColorSpace());print out? If it's not an instance of ICC_ColorSpace, then I can understand the 30 seconds. If it is, then something is dreadfully wrong.
    the RGB bufferedImage that i get after the transformation when it is displayed is much more brightThis is the "one last problem that pops up" that I hinted at. It's because some gamma correction is going on in the background. I have a solution, but it's programming to the implementation of the ColorConvertOp class and not the API. So I'm not sure about its portability between java versions or OS's.
    import javax.swing.*;
    import java.awt.color.ICC_ColorSpace;
    import java.awt.color.ICC_Profile;
    import java.awt.image.BufferedImage;
    import java.awt.image.ColorConvertOp;
    import javax.imageio.ImageIO;
    import java.io.File;
    public class CMYKTest {
         public static void main(String[] args) throws Exception{
            long beginStamp, endStamp;
            //load image
            beginStamp = System.currentTimeMillis();
            BufferedImage img = ImageIO.read(/*cmyk image file*/);
            endStamp = System.currentTimeMillis();
            System.out.println("Time to load image: " + (endStamp-beginStamp));
            //color convert
            BufferedImage dest = new BufferedImage(img.getWidth(),
                                                   img.getHeight(),
                                                   BufferedImage.TYPE_3BYTE_BGR);
            beginStamp = System.currentTimeMillis();
            sophisticatedColorConvert(img,dest);
            endStamp = System.currentTimeMillis();
            System.out.println("Time to color convert: " + (endStamp-beginStamp));
            //display
            JFrame frame = new JFrame();
            frame.setContentPane(new JScrollPane(new JLabel(new ImageIcon(dest))));
            frame.setSize(500,500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        public static BufferedImage sophisticatedColorConvert(BufferedImage src,
                                                              BufferedImage dst) {
            ICC_ColorSpace srcCS =
                    (ICC_ColorSpace) src.getColorModel().getColorSpace();
            ICC_Profile srcProf = srcCS.getProfile();
            byte[] header = srcProf.getData(ICC_Profile.icSigHead);
            intToBigEndian(ICC_Profile.icSigInputClass,header,12);
            srcProf.setData(ICC_Profile.icSigHead,header);
            ColorConvertOp op = new ColorConvertOp(null);
            return op.filter(src, dst);
        private static void intToBigEndian(int value, byte[] array, int index) {
                array[index]   = (byte) (value >> 24);
                array[index+1] = (byte) (value >> 16);
                array[index+2] = (byte) (value >>  8);
                array[index+3] = (byte) (value);
    }

  • How can i create 256 colors (8 bits) jpeg ?

    Dear all :
    The jpeg created by JPEGEncoder was in true color (24 bits) , how can i create or convert the jpeg to 256 colors . Because i want to convert the jpeg to gif in further , but the gifencoder i found can only accept the images that with 256 colors only , so any one can give me a help ? Or the ways that convert a jpeg to gif using java ?

    To reduce the number of colors in an image, try:
    http://www.gurge.com/amd/java/quantize/
    This does a very good job of reducing colors without making the image look too different.
    Further, if you want to encode a GIF file, try using:
    http://www.acme.com/java/software/Acme.JPM.Encoders.GifEncoder.html
    There should be some sample code which shows you how to use those packages on their respective websites. Hope this helps!

  • Grey area in the JPEG image

    Recently my external hard drive with thousands of pictures failed. So I moved all of the files on the external to my Mac harddrive. I deleted the contents of the external hard drive. Now when I open the images (some not all) open with this grey area in the jpeg image. I'm assuming the file is partially corrupted. How can I restore the entire picture? The file size of the images seems to be the entire file but not showing up when I open the file. It does however show the entire picture as a thumbnail icon.
    And other pictures show different colors (not just grey).
    If someone can direct me to a software or perhaps tell me how to fix them. Not sure if Aperture has some capability of fixing this but hopefully someone out there has the answer.
    Cheers,
    Gilbert

    Are they gray, or partially gray in the Finder QuickView, Preview, etc or only in Aperture? If the former, then yeah they may be damaged beyond repair but if it is only Aperture, then it could be the in-app thumbs that are bad and you could try reconnecting them and then rebuilding thumbs.

  • How to create an Average Image from Gray Scale (8 bits) JPEG Images

    I�m trying to create a mean image from 9 JPEG Images, but this mean image has lots of "noise", is distorced, and doesnt�resemble at all the original ones.
    I need this mean image so I�ll correlate each of the original ones to find out the best image I�m going to choose ussing NCC (normalized cross correlation coeficient).
    When I use setRGB(x,y,rgb), it returns diferent "images" according to the number of zeros, for ex.: rgb = 028028028 is different from 28028028 and from 282828. I can�t find a way to work it out.
    My algorithm is the folowing:
            File f;
            double [] [] pixels = null;
            Color [] [] tempPixel = null;
            Integer [] [] byte0 = null;
            Integer [] [] byte1 = null;
            Integer [] [] byte2 = null;
            Integer [] [] byte3 = null;
         Integer [] [] tempPixels = null;
            mean = null;
            int w,h;
            fileNames = new String[numFrames];
            for (int i=1; i<numFrames; i++){
                fileName = path + "Frame#" + i + ".jpg";
                fileNames[i-1] = fileName;
            // just for getting width, height, for configuring pixels array and
            // buffered images - mean & best.
            fileName = path + "Frame#8.jpg";
            f= new File(fileName);
            try{
                temp = ImageIO.read(f);
            }catch(IOException io){ return false;}
            w = temp.getWidth();
            h = temp.getHeight();
            mean = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_GRAY);
         pixels = new double [w][h];
            byte0 = new Integer [w][h];
            byte1 = new Integer [w][h];
            byte2 = new Integer [w][h];
            byte3 = new Integer [w][h];
            tempPixel = new Color[w][h];
              tempPixels = new Integer[w][h];
            f=null; temp = null;
            //reset pixels values.
            for(int x = 0; x < w; x++){
                for(int y = 0; y < h; y++){
                    byte0[x][y] =0;
                    byte1[x][y]=0;
                    byte2[x][y]=0;
                    byte3[x][y] = 0;
                    pixels[x][y] = 0;
            // read each file (image), and according to W & H and collects the
            // pixels values.
            for(int j=0; j<numFrames-1; j++) {
                f = new File(fileNames[j]);
                try{
                    temp = ImageIO.read(f);
                }catch(IOException io){ return false;}
                if(temp!=null)
                    for(int x=0 ; x< temp.getWidth(); x++){
                    for(int y=0; y<temp.getHeight(); y++){
                        tempPixel[x][y] = new Color(temp.getRGB(x,y));
                  pixels[x][y] = pixels[x][y] + temp.getRGB(x,y) / 16581375;
                        //BLUE
                        byte0[x][y] = byte0[x][y] + (tempPixel[x][y].getBlue());//tempPixel[x][y].getBlue(); //& 0xff;
                        //GREEN
                        byte1[x][y] = byte1[x][y] + (tempPixel[x][y].getGreen());// >>8 & 0xff;
                        //RED
                        byte2[x][y] = byte2[x][y] + (tempPixel[x][y].getRed()); //>>16 & 0xff;
                        //ALPHA
                        byte3[x][y] = byte3[x][y] + (tempPixel[x][y].getAlpha()); //>>24 & 0xff;
                f=null;
            }//end of loop for j<numFrames
            String t0, t1, t2, t3;
            for(int x=0 ; x< temp.getWidth(); x++){
                for(int y=0; y< temp.getHeight(); y++){
                     byte0[x][y] = byte0[x][y] / numFrames;
                    if((byte0[x][y])<10)
                             t0= "0" + byte0[x][y].toString();
                    //else if((byte0[x][y])>=10 & ((byte0[x][y])<100))
                    //    t0 = "0" + byte0[x][y].toString();
                    else
                        t0 = byte0[x][y].toString();
                    byte1[x][y] = byte1[x][y] / numFrames;
                    if((byte1[x][y])<10)
                             t1=  "0" + byte1[x][y].toString();
                    //else if((byte1[x][y])>=10 & ((byte1[x][y])<100))
                    //    t1= "0" + byte1[x][y].toString();
                    else
                        t1 = byte1[x][y].toString();
                    byte2[x][y] = byte2[x][y] / numFrames;
                    if((byte2[x][y])<10)
                             t2= "0" + byte2[x][y].toString();
                    //else if((byte2[x][y])>=10 & ((byte2[x][y])<100))
                    //    t2 = "0" + byte2[x][y].toString();
                    else
                        t2 = byte2[x][y].toString();
                    byte3[x][y] = byte3[x][y] / numFrames;
                    if((byte1[x][y])<10)
                        t3="0" + byte3[x][y].toString();
                    else
                        t3 = byte3[x][y].toString();
                        pixels[x][y] = (pixels[x][y]/numFrames) * 16581375;
                    try{
                        String rgbs = t2+t1+t0;
                        Integer rgb = Integer.valueOf(rgbs);
                              //System.out.println("Valor do rgb: " +rgb);
                        mean.setRGB(x,y,(int)pixels[x][y]);
                    }catch(NumberFormatException nfe){
                        System.out.println("ERROR: Integer to STRING: "  + nfe);
                        return false;
                    }// end of catch

    It�s ok, I�ve already found the solution.
    Thanks.

  • Jpeg image loaded with Loader- loadBytes() does not display when app is deployed on remote server

    I am loading a JPEG  image from the server, using the Loader->loadBytes() and that works when the app is deployed under my local Tomcat server.  When I deploy it on other servers the image is not displayed,  instead of the image I see II*
    On the server side I have java, Spring, BlazeDs and I use RemoteObject on the client.
    The code that loads the image looks like below:
    private function imageLoadResultHandler(event:ResultEvent):void {
        var result:ArrayCollection = event.result as ArrayCollection
        var bytes : ByteArray = result.getItemAt(0) as ByteArray;
        _loader = new Loader();
        _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
        _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderFaultHandler);
        _loader.loadBytes(bytes);
    private function loaderCompleteHandler(event:Event):void {
        var loaderInfo:LoaderInfo = event.currentTarget as LoaderInfo;
        var img:Image = new Image();
        img.source = loaderInfo.content;
        myPanel.addChild(img);
    <mx:RemoteObject id="ro" destination="imageLoadService">
         <mx:method name="loadImage" result="imageLoadResultHandler(event)" fault="faultHandler(event)" />
    </mx:RemoteObject>
    Any help with this problem is much appreciated.
    Thank you,
    Lumi Velicanu

    Hi Dmitri,
    Thank you for the prompt reply, your question about the jpeg content was a helpful pointer.
    I solved the problem, it had nothing to do with flex, it was all on the java side. The image was obtained from converting a TIFF to a JPEG, the conversion was failing and the flex loader was receiveing a tiff and it did not know how to display it.
    The java problem was kind of interesting, I'll post it here as an FYI in case anybody cares :
    On my server the first writer returned by ImageIO was an instance of JPEGImageWriter and on the other servers was CLibJPEGImageWriter. And it happens that  only JPEGImageWrite can write the type of TIFF that we are having.
    The fix was to iterate through all the writers and pick the instace of JPEGImageWrite, instead of the first one found.
    Lumi

  • Playing a series of jpeg images on Firefox (like a video)

    We are having a problem playing a series of jpeg images on Firefox (like a video). It works perfectly on IE, Chrome and Safari.
    Here you can see a demonstration of the problem: [http://www.youtube.com/watch?v=8tG0zuoMbLM http://www.youtube.com/watch?v=8tG0zuoMbLM]
    Our code just loads one Jpeg after another. For some reason this causes Flickering with FF.
    '''How to replicate the problem on our website'''
    You can observe the problem by actually visiting our website. Please follow the link below (use firefox):
    http://www.camba.tv/CameraView.aspx?c=fudraste
    On this page select “Recorded Images” tab and then click “Play” below the image. Please increase play speed by clicking button with”>>” symbol. Once the images are playing you will notice a flicker in Firefox but the same page will not show flickering in Safari or chrome.

    Export to QuickTime Conversion. In format set Image Sequence. In Options pick the format, TIFF would be better than JPEG, which a lossy format. Make folder. Save the images. Process in Photoshop or whatever. Import the images set to one frame or use QT Pro to convert it back to a movie.

Maybe you are looking for

  • Override "Email a Page link" in ribbon button functionality in SharePoint 2013

    Hi, I want to override "Email a Page link" ribbon button functionality on the ribbon control.   <CustomAction Id="Ribbon.WikiPageTab.Share.EmailPageLink"                 Location="CommandUI.Ribbon"                                 Title="Custom Email

  • How to handle the jdbc receiver error

    hi,expert:   I have a synchornous scenario:SAP/ECC(Proxy) to JDBC(SQLServer),ECC Send the message and insert data into the  database,when insert sucessfully the receiver returns the count of the sucessfull inserted  record . Not use store    procedur

  • Footage not capturing anamorphic

    I have 24p anamorphic footage coming in from an XL2 that won't capture anamorphic. My capture settings are set to DV NTSC Anamorphic and it has worked before but now the footage stays 4:3. I have tried multiple capture tests with other settings and c

  • Disk utility and diskutil information doesn't match.

    I'm trying to figure out the layout on one of my mac's. I've been doing unix for about 20 years, but have only just recently started using MAC OS. $ diskutil list /dev/disk0 #:                       TYPE NAME                    SIZE       IDENTIFIER

  • Import Network host objects to Cisco Security Manager

    Is it possible to import complete lists of Network Hosts objects to Cisco Security Manager? Exporting the hosts already defined in the ASAs is easy but how to import them in CSM?? Thanks