How to get a .tif image with n different colors?

Hi..i want to know how can i get a .tif image colored by some colors. I want to do something like this:
if(tifImage.pixel < 0.1) {
tifImage.pixel = yellow;
else if( 0.1 <= tifImage.pixel && tifImage.pixel <0.5){
tifImage.pixel = red;
up to n colors.
I prove the next code, but it is not getting the colors i want.
public void generateImage(BufferedImage bi,double alto,double medio,String output){
          int width = bi.getWidth(); // Dimensions of the image
          int height = bi.getHeight();
          // Some constant colors (as arrays of integers).
          int[] red = {255, 0, 0};
          int[] green = {  0,255,  0};
          //int[] blue = {  0,  0,255};
          int[] yellow = {255,255, 0};
          //int[] background = { 85, 85, 85};
          int[] background = { 255, 255, 255};
          // The original image data will be stored on this array.
          int[][][] imageData = new int[width][height][3];
          // We'll fill the array with a test pattern bars thingie.
          double[] pixelArray=null;
          for(int w=0;w<width;w++)
               for(int h=0;h<height;h++)
                    if(bi.getRaster().getPixel(w,h,pixelArray)[0]>=9000){
                         //lo dejo blanco
                         imageData[w][h] = background;
                    else if(bi.getRaster().getPixel(w,h,pixelArray)[0]>=alto){
                         //lo dejo rojo
                         imageData[w][h] = red;
                    else if(bi.getRaster().getPixel(w,h,pixelArray)[0]>=medio){
                         //lo dejo amarillo
                         imageData[w][h] = yellow;
                    else{
                         //lo dejo verde
                         imageData[w][h] = green;
          // Now we have a color image in a three-dimensional array, where the
          // third dimension corresponds to the RGB components.
          // Convert the color image to a single array. First we allocate the
          // array.
          // Note that this array will have the pixel values composed on it, i.e.
          // each R,G and B components will yield a single int value.
          byte[] imageDataSingleArray = new byte[width*height*3];
          int count = 0;
          // It is important to have the height/width order here !
          for(int h=0;h<height;h++)
               for(int w=0;w<width;w++)
                    // Rearrange the data in a single array. Note we revert RGB, I still don't
                    // know why.
                    imageDataSingleArray[count+0] = (byte)imageData[w][h][2];
                    imageDataSingleArray[count+1] = (byte)imageData[w][h][1];
                    imageDataSingleArray[count+2] = (byte)imageData[w][h][0];
                    count += 3;
          // Create a Data Buffer from the values on the single image array.
          DataBufferByte dbuffer = new DataBufferByte(imageDataSingleArray,width*height*3);
          // Create an pixel interleaved data sample model.
          SampleModel sampleModel =
               RasterFactory.
               createPixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                         width,height,3);
          // Create a compatible ColorModel.
          ColorModel colorModel = PlanarImage.createColorModel(sampleModel);
          // Create a WritableRaster.
          WritableRaster raster = RasterFactory.createWritableRaster(sampleModel,dbuffer,new Point(0,0));
          // Create a TiledImage using the SampleModel.
          TiledImage tiledImage = new TiledImage(0,0,width,height,0,0,sampleModel,colorModel);
          // Set the data of the tiled image to be the raster.
          tiledImage.setData(raster);
          // Save the image on a file.
          JAI.create("filestore",tiledImage,output,"TIFF");
Thanks

I tried that. When I open one image and set the exposure, then go to open the second image, nothing happens. I then saved one image as a psd file, then it would let me open the raw file a second time. When I had both open on the same screen and dragged the layer from one into another image, the layer size ended up being different than the other file. It was shifted down and to the left. I need these images to be pixel locked, and the user experience I went through did not allow me to do this.
I also do not see a way to copy/paste layers between files.

Similar Messages

  • How to open a raw image with two different exposures?

    Hello,
    I am trying to open a raw image file in Elements with two different exposures so that I can use an adjustment layer to blend the exposures. For the life of me, I cannot figure this out, and the online help is completely useless. I have read everything in the online help about working with layers and it does not mention a single thing about this process. I know it can be done because I have done it before with a previous version of Elements, but I remember it being a very awkward experience. Can anyone point me to a page with this technique, or share the secret? Thanks. If anyone from Adobe is watching this forum, please try to make this product easier to use, more intuitive, and less reliant on subtleties, and by all means, PLEASE improve the documentation as it is practically empty of any useful information.
    Thanks,
    Shan

    I tried that. When I open one image and set the exposure, then go to open the second image, nothing happens. I then saved one image as a psd file, then it would let me open the raw file a second time. When I had both open on the same screen and dragged the layer from one into another image, the layer size ended up being different than the other file. It was shifted down and to the left. I need these images to be pixel locked, and the user experience I went through did not allow me to do this.
    I also do not see a way to copy/paste layers between files.

  • How do I select an image with motion blur so that I can put it onto a different background ?

    How do I overlay a image with motion blur on a white background (like the first image) onto a different background (to look like the second image)? any help would be greatly appreciated, many thanks ,ed
    Message was edited by: motoredd

    I’m afraid you may have bitten off more than you might want to chew.
    The resulting pixels of an in-camera-blur combine information about the color/brightness of back- and foreground (edit: the result of surface properties and lighting conditions) with motion (basically transparency for this task) in such a way that it seems exceedingly difficult (maybe even improssible) to isolate the foreground in a »pure« form.
    One may get a halfway decent mask (as the backgound is at least almost uniform and brighter than the foreground elements) but you may have to manually decontaminate the transparent areas, otherwise the masked object in front of a dark background would have a bright edge.

  • How do I convert raw images with side car to Dng and

    How do I convert raw images with side car to Dng and preserve the sidecar info in the DNG?
    I have tons of raws + xmp sidecars that i want to convert to dng, because the raws are from different camera brands and i want to get everything simplified. so that i do not have to worry if I will be able to access the raws in the future, if I decide I want to rework some of the files.
    T.I.A.

    If the images are already in your catalog you can select them then choose Convert Photos to DNG from the Library menu. You'll be given the option of deleting the original raw files. Either way, Lr will only display the newly created DNG files.
    The alternative, which is better suited to images not already in the catalog is to use the Adobe DNG Converter

  • I need to replace a color on my image with a specific color from another part of the image.  How?!

    I have spent over 2 hours trying to figure out how to replace a color on one part of my image with a specific color shown on another part of the image.  So far I have been able to go to "Replace Color" on my Adobe Photoshop version, but it seems that I can only change the hue and brightness of the color that it currently is.  I need to use a specific color so this does not help me.  Does anyone know how to complete the task I am referring to?
    Also, please keep in mind that I am using Adobe Photoshop 6.0, not a fancy cs version or anything.  So it's pretty old school...
    Any help/feedback is greatly appreciated!  Thank you.

    Hi brookehelene,
    You might consider making a selection the object and using a color fill layer set to the color blend mode instead of replace color.
    I used the same picture as kendallplant did and changed the color on the same flower by sampling the pink color from the flower to the right)
    (click on the screenshots below for larger views)
    1. Select>Color Range
       (i used color range because the dialog is somewhat similar to the replace color dialog, except one is making a selection instead of replacing a color)
       (there are many other ways to make the selection such as the magic wand, so if your more familar with the other selection tools you can use those instead to make your selection)
    2. Use the eyedroppers and fuzziness slider in the color range dialog to make the selection of the object.
       (in the screenshot below the white areas are selected and black areas are not)
       (your selection probably won't be perfect, but you can paint on the layer mask to refine the selection)
    3. After you press the okay in the color range dialog you'll see the selection (marching ants)
       At the bottom of the layers palette press the Create New Fill or Adjustment Layer icon
       to reveal a list and choose Solid Color.
       Then use the eyedropper to sample a color from your image and press ok.
       Change the Blend mode for the color fill layer to Color (top of the layers palette)
    4. As you can see a lot has been selected besides the flower.
        To refine the areas of color, paint on the layer mask with the paintbrush tool.
        Use white to add the color or black to subtract the color
        You can press the D key on the keyboard to get the default colors (black and white) in the toolbox
        and press the X key to switch between the two when painting on the layer mask.
    Even though the above takes longer you can easily change the color or modify the areas that you want to change the color on.
    To change the color you can double click on the color fill icon in the layers panel.
    You can also use other layer blend modes besides color such as hue, so you might try some of the others and see what they do.

  • How to get an error icon with tool tip in a displaying table   in a particu

    How to get an error icon with tool tip in a displaying table   in a particular field..
    Thanks.

    Hi,
    In the context  create an attribute of type string .
    Create the attribute in the node which you bind for table.
    In the layout .
    1.create a Table UI element.
    2 create binding for UI element.
    3Right click on the Table UI and select insert table column.
    4.once the table column is inserted right click on table column and select insert cell editor.
    5.create the cell editor of the type image.
    6.Bind the source property of the image to the attribute in the node which you have created.
    so depending on what image(type of icon) needs to be displayed set the attibute accordingly.
    refer to the link for image :
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/d1/af8841349e1909e10000000a155106/frameset.htm]
    Priya

  • How to load a tif image in flex

    Hi All,
    Is it possible to load a tif image in flex. If it's possible
    anyone guide me or send me some code snippets regarding how to
    display a tif image in flex.
    Regards,
    Dharma

    "flexdharma" <[email protected]> wrote in
    message
    news:ga2d96$p8h$[email protected]..
    >
    Hi All,
    > Is it possible to load a tif image in flex. If it's
    possible anyone guide
    > me or send me some code snippets regarding how to
    display a tif image in
    > flex.
    Convert it to the much more web-friendly png format.

  • Has anyone figured out how to get speech recognition working with sticky keys enabled on mountain lion?

    I'm trying to use speech recognition to input text on my iMac running the latest mountain lion, 10.8.3.
    I have sticky keys enabled.
    When I try to start speaking by pressing the function key twice nothing happens. I can only get it to work if I disable sticky keys.
    The same problem occurs with all the other modifier keys as shortcut, they do not work with sticky keys.
    When I try to select a different shortcut, I am unable to select a two key combination, but am limited to one.
    If I select the F6 key, or any other single key, I am able to start speech recognition. However the second time that I press the key, it does not stop recognition and process my words. Instead, it restarts the recognition.
    Has anyone figured out how to get speech recognition working with sticky keys enabled?
    Or a way to get an individual key shortcut to start on the first press and process it on the second?
    Or a way to get key combinations to work, as specified by the help:
    Dictation On and Off
    To use Dictation, click On.
    When you’re ready to dictate text, place the insertion point where you want the dictated text to appear and press the Fn (function) key twice. When you see the lighted microphone icon and hear a beep, the microphone is ready for you to speak your text.
    Shortcut
    By default, you press the Fn (Function) key twice to start dictation. If you like, you can choose a different shortcut from the menu.
    To create a shortcut that’s not in the list, choose Customize, and then press the keys you want to use. You can press two or more keys to create your shortcut.

    I noticed with version 10.8.4 of OS X that I am now able to select F6 to activate, and the return key to complete the speech recognition. This is still different than the description of how these should function that's included in the help, but at least it's an improvement.

  • How to get gui_download and gui_upload with popup filename?

    how to get gui_download and gui_upload with popup filename?

    Here is a short example.
    report zrich_0003 .
    data: ifiletab type filetable.
    data: xfiletab like line of ifiletab.
    data: xstring type string.
    data: rc type i.
    data: itab type table of string.
    data: xtab type string.
    start-of-selection.
      call method cl_gui_frontend_services=>file_open_dialog
        changing
          file_table              = ifiletab
          rc                      = rc.
      read table ifiletab into xfiletab index 1.
      xstring = xfiletab-filename.
      check not xstring is initial.
      call method cl_gui_frontend_services=>gui_upload
        exporting
          filename                = xstring
      changing
        data_tab                = itab.
      loop at itab into xtab.
        write:/ xtab.
      endloop.
    Regards,
    Rich Heilman

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • How to get the contents associated with a component.

    How to get the contents associated with a component.
    Like i have 2 buttons and i want to get the contents associated with these button without clicking them i.e without firing the event.
    By Contents i mean, whatever things we get after firing the event,we get some other window and some thing is added to the current page and so on.

    grab all the code inside the actionPerformed(ActionEvent e) method

  • How to get a minus sign with the cost  field in ALV.

    Hi ,
    How to get a minus sign with the cost field in ALV.
    The Ouput will be displayed like  Rs -1500 instead of 1500-
    I can't use concatenate also as i may have to use the sum functionality of ALV .
    Cheers
    Sunny

    Hi sunny,
    1. The OTHER FIELD
       has to be character field of say length 15.
    2. Write the original numeric value to
       this character field (in a loop)
    3. But simply writing won't help.
    4. use this kind of logic.
    5.
    REPORT abc.
    DATA : m TYPE i.
    DATA : chr(15) TYPE c.
    m = -100.
    WRITE m TO chr.
    IF m < 0.
      SHIFT chr RIGHT BY 1 PLACES.
      CONDENSE chr.
      CONCATENATE '-' chr INTO chr.
    ENDIF.
    WRITE chr.
    regards,
    amit m.

  • How can I view all images with Safari on my mac?

    how can I view all images with Safari on my mac? When I go to pinterest or any stock photo site I can only see some of the images on my mac.

    Please link to an example of a page you're having problems with. It should be accessible without a login.

  • How to get vlan tag programe with mac book air

    how to get vlan tag programe with mac book air,i'm using the usb ethernet adapter

    For prompt help contact TATA.
    For more on this: https://discussions.apple.com/thread/3680625?tstart=270

  • How do I batch resize images with different aspect ratios?

    How do I batch resize images with different aspect ratios?

    poa66 wrote:
    Landscape: I want result to be 1960 x 1103 px and 72 ppi whether the original is 300 ppi or 220 ppi and wether it is 2Mb or 10 Mb. Cropped centered top and bottom.
    There will be a set of Landscapes that that have a narrower aspect ratio the 1960:1103 that would also need the top and bottom cropped like all Portraits would could be.  You need to realize that center cropping Landscape image that have aspect ratios near 1960:1103 will usually produce acceptable compositions.  However Cropping wide panoramas and portraits will only produce acceptable landscape  1960:1103 composition occasionally.
    Here you will see what happens when image have aspect ratio the do not fit the desired aspect ratio.  Where Landscape  are forced to portrait and portrait forced to Landscape.  Here are two Collage I populated with a mixture of image  with different  aspect ratios.   One collage has all 3:2 Landscape places and the other 2:3 Portrait places.
    I create a 1 image 1960x1103 collage 72dpi and create those too. Note the landscape boy foot is cropped off 3:2 is narrow compared to 1960:1103

Maybe you are looking for