How to getPixels of a big image

Hello,
How to getPixels of a big image?
for(int i = 0; i < planarImage.getHeight();i++) {
    planarImage.getData().getPixel(0,i,tab);
}This code works for a small image 1728 x 2592 but when we load an big image (7000x10000):
java.lang.OutOfMemoryError: Java heap space
Dumping heap to /Users/pierre/NetBeansProjects/projetTER/nbproject/private/profiler/java_pid486.hprof ...
Heap dump file created [12872497 bytes in 0.133 secs]
Exception in thread "Thread-15" java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:59)
        at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:397)
        at javax.media.jai.RecyclingTileFactory.createTile(RecyclingTileFactory.java:397)
        at javax.media.jai.PlanarImage.createWritableRaster(PlanarImage.java:1995)
        at javax.media.jai.PlanarImage.getData(PlanarImage.java:2173)
        at javax.media.jai.PlanarImage.getData(PlanarImage.java:2029)
        at javax.media.jai.RenderedOp.getData(RenderedOp.java:2277)
        at jai.scale.RenderableScale$2.run(RenderableScale.java:175)
        at java.lang.Thread.run(Thread.java:637)Can I load a part of image?
Thanks.

You should check out tiling, if the image is tiled it doesnt need to be in memory all at once.
Of course you probably need to set the heapsize to a reasonable value eg
-Xmx256m
I would suggest about half your main memory.

Similar Messages

  • How can i show a big image on screen

    I want to show a big JPG image(for example 100M ) on screen. The program is wrong when I only display 10 pecent of it , the error message shows "out of memory" .My GOD ,what can I do ?

    That would take forever to generate something that large. You may want to re-size it or change the resolution so it is a lot smaller. Look into the JAI pacakge for this kind of stuff.

  • How resize layer with a big image on size of layer mask ?

    Hi all
    How to resize the image on the layer mask?
    * document - doc.width, doc.height
    * mask - activeLayer.bounds
    * and how to take the coordinates in the image with the mask if the image is larger than the size of the document?

    //For deleting the Layer Mask I recommend recording Action Manager code with ScriptingListener.plugin
    I'm write script on delete LM in ScriptListener, but it not worked !
    var idsetd = charIDToTypeID( "setd" );
      var desc162 = new ActionDescriptor();
      var idnull = charIDToTypeID( "null" );
      var ref125 = new ActionReference();
      var idLyr = charIDToTypeID( "Lyr " );
      var idOrdn = charIDToTypeID( "Ordn" );
      var idTrgt = charIDToTypeID( "Trgt" );
      ref125.putEnumerated( idLyr, idOrdn, idTrgt );
      desc162.putReference( idnull, ref125 );
      var idT = charIDToTypeID( "T " );
      var desc163 = new ActionDescriptor();
      var idUsrs = charIDToTypeID( "Usrs" );
      desc163.putBoolean( idUsrs, false );
      var idLyr = charIDToTypeID( "Lyr " );
      desc162.putObject( idT, idLyr, desc163 );
    executeAction( idsetd, desc162, DialogModes.NO );
    Resizing it should be possible in DOM by selecting it (as the sole content of an Array for activeDocument.activeChannels).
    Please, help me to defined 4 variables (left, top, right and bottom)!
    row 33, 36 - indent Hor and Vert
    row 41, 44 ??? This is %%  !!!
    // =======================================================
    var idslct = charIDToTypeID( "slct" );
      var desc164 = new ActionDescriptor();
      var idnull = charIDToTypeID( "null" );
      var ref126 = new ActionReference();
      var idChnl = charIDToTypeID( "Chnl" );
      var idOrdn = charIDToTypeID( "Ordn" );
      var idTrgt = charIDToTypeID( "Trgt" );
      ref126.putEnumerated( idChnl, idOrdn, idTrgt );
      desc164.putReference( idnull, ref126 );
      var idMkVs = charIDToTypeID( "MkVs" );
      desc164.putBoolean( idMkVs, false );
    executeAction( idslct, desc164, DialogModes.NO );
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
      var desc165 = new ActionDescriptor();
      var idnull = charIDToTypeID( "null" );
      var ref127 = new ActionReference();
      var idLyr = charIDToTypeID( "Lyr " );
      var idOrdn = charIDToTypeID( "Ordn" );
      var idTrgt = charIDToTypeID( "Trgt" );
      ref127.putEnumerated( idLyr, idOrdn, idTrgt );
      desc165.putReference( idnull, ref127 );
      var idFTcs = charIDToTypeID( "FTcs" );
      var idQCSt = charIDToTypeID( "QCSt" );
      var idQcsa = charIDToTypeID( "Qcsa" );
      desc165.putEnumerated( idFTcs, idQCSt, idQcsa );
      var idOfst = charIDToTypeID( "Ofst" );
      var desc166 = new ActionDescriptor();
      var idHrzn = charIDToTypeID( "Hrzn" );
      var idPxl = charIDToTypeID( "#Pxl" );
      desc166.putUnitDouble( idHrzn, idPxl, 13.500000 );
      var idVrtc = charIDToTypeID( "Vrtc" );
      var idPxl = charIDToTypeID( "#Pxl" );
      desc166.putUnitDouble( idVrtc, idPxl, -6.500000 );
      var idOfst = charIDToTypeID( "Ofst" );
      desc165.putObject( idOfst, idOfst, desc166 );
      var idWdth = charIDToTypeID( "Wdth" );
      var idPrc = charIDToTypeID( "#Prc" );
      desc165.putUnitDouble( idWdth, idPrc, 125.064267 );
       var idHght = charIDToTypeID( "Hght" );             What is this ?&&&&
      var idPrc = charIDToTypeID( "#Prc" );
      desc165.putUnitDouble( idHght, idPrc, 135.227273 );
      var idIntr = charIDToTypeID( "Intr" );
      var idIntp = charIDToTypeID( "Intp" );
      var idBcbc = charIDToTypeID( "Bcbc" );
      desc165.putEnumerated( idIntr, idIntp, idBcbc );
    executeAction( idTrnf, desc165, DialogModes.NO );

  • How to load big images in Java?

    Hello all,
    is there any possibility to load a big images about 200-500 Mb with Java Graphics API ?
    This code throws OutOfMemory Exception.
            try {
                BufferedImage img = ImageIO.read(new File("testpic1.bmp"));
                int w = img.getWidth(null);
                int h = img.getHeight(null);
                bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
                Graphics g = bi.getGraphics();
                g.drawImage(img, 0, 0, null);
            } catch (IOException e) {
                System.out.println("Image could not be read");
                System.exit(1);
      protected void paintComponent(Graphics g) {
       g2D.drawImage(bi, null, 0, 0);
      }I can't extend memory for the JVM because of my requirement. So I have to load a picture partly as user access to it.
    I am very thankful for every idea.

    I try to read an image like this:
    The size of the image is 10000x4000
    How can I read from Buffer 6000-5700 = 300 for width and 3000-2700 = 300 for heigth?
    If I do it like that
    bi = new BufferedImage(6000, 3000, BufferedImage.TYPE_INT_ARGB);
    I read more, than I need.
    Is there somthing like
    bi = new BufferedImage(5700, 2700, 6000, 3000, BufferedImage.TYPE_INT_ARGB);
    ??

  • How convert a big image to parts of images? means split a jpg image to several sub imges.(thi​s sub image can joint into that big image)

    hi friends..
    how convert a big image to parts of images? means split a jpg image to several sub imges.(this sub images can joint into that big image) any help
    Solved!
    Go to Solution.

    In the example, i have created two images and added them together, and the converse can be done in the same way.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • How can i put one small image on another big image at particular point

    Hi,
    I have combined two images but new mask image is totally overwrite and come in whitecolored not in original color.....
    I have user CGImageMaskCreate, CGImageCreateWithMask......
    But i want to put small image on big image at particular point...... that i m tired to search but i can't find.......
    Any thing is remaining then pls tell me...
    Thanks,
    Haresh.

    Check the Quartz2D documents on Apple's site. Do a search in your examples folder in the developer folder and on Apple's site for Masks. I haven't used them under this API but that's probably the best place to start.

  • How do I show multiple rollover images on a page inserted dynamically (pulled out of a sql database

    How do I show multiple rollover images on a page inserted dynamically (pulled out of a sql database table) using Dreamweaver’s Repeat Region. Example: I have different products each one associated (through their productID) with two images (one that’s showing in the page and one for the rollover effect) that are pulled from a database using Dreamweaver’s Recordset. So I want to end up with a page containing row after row of images(one for every product).When moused over each image will reveal the second (rollover) image for the same product which in turn can be a link(the image itself ) that when clicked leads to a detailed page with more information about the product the image is associated with. To show row after row with images for the different products in the database table I am using Dreamweaver’s Insert Rollover Image command and then the  Repeat Region – I have no problem to complete the steps, to insert the image and the rollover one at once and set the paths so they are pulled dynamically depending on the productID they are associated with .I have also no problem to apply the Repeat Region so not only the first image associated with the first product in the table is shown but all of them-a routine and standard procedure when using the Repeat Region to dynamically generate and display multiple rows of data. However, when I preview the page the rollover effect is lost –the images are shown but when moused over the second  image does not  show. The problem is caused when the Repeat Region is applied-once again I am allowed to apply it but the rollover stops working, a kind of interference. ANY SOLLUTION PLEASE, ANY WORK AROUND.

    I gotta tell you, using multiple images for rollover effects is going to be a big challenge in your dynamic scenario. 
    If this were my product page, I would use thumbnails with a bit of CSS opacity or filters to desaturate and make them full opacity/color on mouse over.  Nice effect with much less bandwidth. Easily done globally with CSS code.
    Two examples:
    http://alt-web.com/GALLERY/GalleryTest.php
    http://alt-web.com/TEMPLATES/CSS-Semi-liq-photo-sheet.shtml
    Nancy O.

  • How can i convert a hexidecimal image file to a bmp file

    i have an array of hex data, each of the 7707 rows has 80 characters, i want to convert this to a standard windows bmp or jpeg file, any ideas how to do it?

    stewbert;
    Is that only one image or there are several images in that array? If the array is the image, and columns (number of characters) and rows correspond to what you are saying your array contains, it is a big image!
    There are other questions that needs to be answered, like, each character, how many numbers contains (looks like "EF" or like "EF3B5A".) Such sizes give ideas of the format and to where is the color table.
    You can play with the "Draw XXX Pixmap" VIs located in Function palette -> Graphics & Sounds -> Picture Functions and see if one of them renders an image.
    I think the best would be if you can post a sample of your array so somebody here can look at it and try to "decode" it.
    Regards;
    Enrique
    www.visecurity.com
    www.vartortech.com

  • How to include zoom option for images and video in adobe captivate5?

    I am developing an elearning software with captivate 5 which has images and video.
    I want to include an option to be able to zoom the images and video if clicked on the particular area.
    It should zoom any part of the image when clicked on it during run time and go back to original size when clicked again.
    How can I do this?

    1. I try with two images: The thumbnail y the Big Image Zoom image Detail.
    2. I Use Dinamic Images
    3. check this tip

  • How to convert Doc file into image

    hello frnds
                     Can any body guide me how to convert doc file into image and show into swf loader.
    actually i have to convert doc files into swf files in runtime so that i have to use this flow.
    is it possible to convert doc file into byte array and than convert into image.
    Thanks And Regards
        Vineet Osho

    You can convert any DisplayObject to byeArray using this function ImageSnapshot.captureBitmapData().getPixels()

  • How to display  servlet dynamically generated image ?

    Hi,
    How to display servlet dynamically generated image ?
    I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
    **Try n# 1 **************************************************************
    This displays my image but nothing elle :
    ServletOutputStream sos = pResponse.getOutputStream();
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(img);
    **Try n# 2 ****************************************************************
    I tried also :
    In the servlet :
         request.setAttribute("renderedImage", img);
    and in the jsp page :
         BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
         <img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
    This last try draws big crap in the jsp page, thank you in advance.
    Nelson

    Call another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).

  • How can I scroll around an image if its zoomed out?

    Hey guys, quick one for you.
    I have no problem using the hand tool/spacebar to scroll around an image when zoomed into it, but as soon as I can see the whole thing I can't scroll around anymore and its just locked to the center
    I am a After Effects user so I find this a bit annoying that I can't do this, so I figure there MUST be a setting somewhere I could change to enable it.
    Thanks!

    by Buko wrote:
    Sorry but "How can I scroll around an image if its zoomed out?" has got to be one of the stupidest question I've heard on this forum in some time. Brandon really needs to think before posting.
    I've noticed your usual vitriol toward people having simple questions has ramped up about 200% since the advent of Jive, Buko. Maybe you need to disengage, or neck some holy fermented blue agave juice and take a nap?
    I see the question as perfectly cromulent, and I use the suggestion I've given quite often. Apparently, a good reason why anyone would want to do that has escaped you, and it's made you even crankier than usual. So you react by giving the gift of vile condescension instead of just ShuttingTFU and letting someone else handle it. (Next time you blast Ramon for the same thing, take a look at your own behavior). And apparently, it's not enough for you to just accept that the way someone else wants to work is different than your workdflow, or is something that never even occurred to you. Maybe some folks just want an answer to their question, and secretly wish you'd shove your bad attitude up your [asterisk-substituted name for your lower-dorsal body opening]. Of course, some folks are just too polite, or they're new visitors here and won't say that to you because they don't know the legacy players and behaviors here. But I'm not either of those things, and I will. Because if you can dish it out, surely you can take it, right? RIGHT!?!?
    Now...why do I think the question is worth answering? Sometimes I want to be able to have an entire smallish image visible at 100% magnification in order to view it as it will appear in its final destination. AND I want to do some work on it while keeping all my currently-open Palettes visible; maybe I want to move my image out of the way of a big dialogue box I've called up. (I'm only working on one monitor...sorry if that makes your hardened jaw drop down to your chest).
    In Single-Window made mode I'd have to grab and move the whole window, but I can't do that if I have a big dialogue window open. In full screen mode I can scroll around and see all parts of that image at 100% without having to Tab my palettes to their hidden state, or shove my open dialogue nearly off-screen.
    Think past your own nose, Dude! And LightenTFUp!

  • Big images

    Hi all,
    I'm trying to write a program that handles really big images (scanned maps for example). These images can easily have about 100 MB size.
    How can I deal with that big images in Java? I tried to use the new ImageIO package to get the image data loaded, and then the affineTransform class to do image manipulation. But this approach doesn't work properly.
    I get exceptions and system crashes as the images get larger and it takes REALLY long if it works
    With small pics up to a few 100 KB all works fine, but big ones... no!
    Has anyone experience in dealing with big images?
    Any other approach? My idea is, to get the actual pixel data in an array and do the manipulation "by hand", because the problem seems to be the affineTransform class.
    Any help is welcome
    thanx in advance
    Herby

    any hints?

  • How do i use my own image with keying (or green screen)

    how do i use my own image witrh keying (or green screen)

    Put your sky clip on a layer below the clip you want to key. One or the other will be a connected clip. Apply  the Keying filter to foreground clip (the one with the green screen). The green will be seen as transparent and the sky will show through as the BG. Adjust as necessary in the Inspector.
    Good luck.
    Russ

  • I have created a 468x60 animated banner in Edge Animate. How do I save the animated image to my desktop? (not in html code)

    I have created a 468x60 animated banner in Edge Animate. How do I save the animated image to my desktop? (not in html code)

    Hi,
    This feature is not available in Adobe Edge animate. You can not export as image from Edge animate.
    Publish options available in edge describe here
    Edge Animate Help | Publish your content
    Regards,
    Devendra

Maybe you are looking for