Applying color to grayscale bitmaps?

Hi,
This is more of a "how does InDesing do it" kind of question vs scripting, but since the InDesign developers hop on here once and a while, I thought I'd ask.  How does InDesign colorize grayscale images - is it doing a HSL transformation on each pixel, grabbing the S and L values for said pixel, and back-calculating a new RGB value for the target H value?
Thanks!

Were areas of your original image transparent?
Remember that by default all int arrays are popuated
with zeroes. In the case of an "RGB" format image,
that represents opaque black (transparent black in
"ARGB"). So when you create a new RGB image, it's
opaque black by default.
Otherwise, dunno, if your background was nearly white
but not quite (eg 0xfffefefe) maybe the threshold
makes any non-white value black. I've not converted
to binary images before, only from.Thanks !
I think that this is exactly the problem.
The problem is that I can't figure out where exactly I need to set the isOpaque property to true. I thougt maybe to scan the original image with a mask that sets alpha to opaque (is it 0x00 or 0xff ?), but it seems very inefficient to me. Is there another way ? Here is my code:
public static BufferedImage getBinaryImage(String filename) {
     BufferedImage originalImage = null, binaryImage;
     try {
          originalImage = ImageIO.read(new File(filename));
     } catch (IOException e) {
          System.out.println("Could not open file: " + filename);
          System.exit(1);
     binaryImage = new BufferedImage(originalImage.getWidth(), originalImage.getHeight(), BufferedImage.TYPE_BYTE_BINARY);
     binaryImage.createGraphics().drawImage(originalImage, 0, 0, null);
     return binaryImage;
}

Similar Messages

  • Drag and drop to apply color to art.

    Hi All,
    I am designing a panel for Illustrator CS6 that displays colors in a datagrid as follows,
    [Color] [Color_Name]
    I want to be able to apply color to any art by using the drag-n-drop from the panel to the document. Is it possible that I am able to detect the art on which the color was dropped so that I can apply the color?
    Thanks!

    I came upon the NativeDragManager class of the CS Extension. We can use it to drag and drop objects from the panel to the application document. For this we use the ClipBoard and specify the format of the clipboard data. There are quite a few formats, namely, bitmap, text, url, file, etc. However, I couldn't use any of these so that I might drag a color from my panel to the document.
    Here is a code to drag and drop a text from panel to document,
    var clip:Clipboard = new Clipboard();
    clip.setData(ClipboardFormats.TEXT_FORMAT, designsDG.selectedItem.Colors);
    var allowedActions:NativeDragOptions = new NativeDragOptions();
    NativeDragManager.doDrag(designsDG.selectedItem as InteractiveObject, clip);
    Here designsDG is the datagrid containing the text.
    How can I do something similar for a color object?
    Any inputs?

  • Converting from indexed color to grayscale no longer works in CS4

    I have a number of files to convert from indexed colors to grayscale. Did some but clicked "don't show me again" box on the Discard Colors warning. Now I can't make the conversion. Everything looks fine, but when I close file, then reopen, it's reverted to indexed colors - restarting Photoshop or the computer doesn't help.
    I'd appreciate any help....Thanks, Grant

    Grant,
    All your contact information is posted to the web. These forums are crawled by bots harvesting info.
    I don't think you want additional junk mail, unsolicited phone call scams, and possible attempts to crack your website, do you?
    People here recommend not to post contact info. Perhaps a forum moderator can remove your personal info, but you might be able to edit your post yourself.
    GIF only uses indexed color mode, So if you want your files to NOT be in the Indexed Color mode you need to save them as another file format like .png or .jpg

  • How can I export to PDF for Offset printing including color and grayscale photo's?

    After reading dozens of forum, I still don’t found the answer.
    I made a photobook with full-colur and B/W photos for Offset printing. I want the B/W to be in grayscale to avoid color possible color shades. It seems InDesign doesn’t support grayscale, the images become way to dark. Even with exporting without any colour conversion or destination and/or including original colour profiles, the grayscale pictures are being exported to dark to PDF.
    How can I export to PDF for Offset printing including color and grayscale photo’s?

    Yes, the Photoshop & ID CMYK working spaces are the same
    This can get difficult because the 3 programs handle soft proofing differently.
    The working spaces don't matter, it's the document profile(s) that manage the preview. So here is the same grayscale image placed in ID on top and PS on the bottom. I've set my Photoshop info to show the doc profile in the lower left corner. I can see my InDesign's Document CMYK profile in my Proof Setup (the Working CMYK is different and isn't being used). Both profiles are effectively the same Coated FOGRA39 (Black Ink FOGRA in the case of PS).
    But the previews don't match because I have Overprint turned off, so the InDesign preview is Gamma 2.2 or a "screen" media preview.
    If I turn on Overprint preview I get a match because I'm soft proofing for print:

  • Applying color to Heading of a page in ALV reports

    Hi Experts,
    I want to apply color to heading of a page in ALV reports ,if any one knows please help me.
    Regards,
    Satya.

    Is that what you mean?
    DATA it_sflight TYPE TABLE OF sflight.
    SELECT * FROM sflight INTO TABLE it_sflight UP TO 10 ROWS.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program          = sy-repid
        i_callback_html_top_of_page = 'TOP_OF_PAGE'
        i_structure_name            = 'SFLIGHT'
      TABLES
        t_outtab                    = it_sflight
      EXCEPTIONS
        program_error               = 1
        OTHERS                      = 2.
    FORM top_of_page USING document TYPE REF TO cl_dd_document.
      DATA lo_table_area TYPE REF TO cl_dd_table_area.
      CALL METHOD document->add_text
        EXPORTING
          text         = 'Some text'
          sap_emphasis = cl_dd_area=>heading
          sap_color    = cl_dd_area=>list_negative.
      CALL METHOD document->add_table
        EXPORTING
          no_of_columns               = 2
          cell_background_transparent = space
        IMPORTING
          tablearea                   = lo_table_area.
      CALL METHOD lo_table_area->add_text
        EXPORTING
          text      = 'Some text2'
          sap_color = cl_dd_area=>list_key.
      CALL METHOD lo_table_area->add_text
        EXPORTING
          text      = 'Some text3'
          sap_color = cl_dd_area=>list_background.
      CALL METHOD lo_table_area->new_row.
    ENDFORM.                
    If not, please let us know which part of ALV you exactly want to color.
    Regards
    Marcin

  • Unable to apply color formatting to document library custom view using javascript

    Hello,
    I have applied color formatting to some values in Document library at "Allitems.aspx" page.
    Created one view where record of library displaying as per sort rule and trying to apply the color formatting on that view, but its not getting apply.
    also tried to insert that list as web part in one page with the same view(created by me) and tried applying color..but not working.
    I used below script for color formatting, included in script editor web part:
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
    $Text = $("td.ms-cellstyle.ms-vb2:contains('Very limited risk - acceptable A')");
    $Text.css("background-color", "#7FFF00");
    $Text = $("td.ms-cellstyle.ms-vb2:contains('Measures Required (in 6 months) - M')");
    $Text.css("background-color", "#D2691E");
    $Text = $("td.ms-cellstyle.ms-vb2:contains('Immediate measures required - I')");
    $Text.css("background-color", "#6495ED");
    $Text = $("td.ms-cellstyle.ms-vb2:contains(Stop work until measures are taken - S)");
    $Text.css("background-color", "#DC143C");
    </script>
    Could please suggest a way out.
    Thanking you in advance.
    Regards,
    Jayashri

    Hi Jayashri,
    Follow the steps to debug your JS code, preferable in IE browser
    Press F12 to open your developer tool
    Select Script tab
    Search for your code, set debugger point by clicking on the left extreme position on line numbers
    Click on Start debugging at top, if its not there in your browser just refresh the page, it will hit the debug point.
    Hope it will help you in debugging your code, if you need any further details about debugging this, mail me @
    [email protected]
    Thanks
    Shakir

  • Mixer Brush is not applying color?

    In CS6, I am trying to apply color to the Canvas with the Mixer Brush, though it is not working. I am using Wet, Heavy, Mix brush and I select Blue as my foreground color, the color is showing in the toolbox and up above in the options bar, though when I paint it just seems to smudge the colors on the canvas. What is wrong with my settings? Thanks.

    I don't use the mixer brush often, but here are what some of the settings do:
    Wet determines how much color is picked up from the canvas to load the brush, so a setting of 0 will only pick up what's in your "resovoir" or the color you picked. 
    Load is how much paint is picked up and how long that color will last in one stroke.  So if you set this at a high number, the loaded color will keep continuing painting, whil a low number will start to fade sooner.
    Mix will only come on if there is some value other than 0 in wet, as it determines how much the brush will mix with the canvas.  So the high the number the more the brush will mix just the color on the canvas and not what's loaded into the brush.

  • Photoshop document with smart objects changed when I apply color profile. Why?

    I work in Photoshop with smart objects. When I apply color profile smart object are changed. For example change filter or change size. I dont now why?
    See image

    Yes, fortunately, I am a Windows user, but I don't want to start a religious war here And it is also possible to run multiple versions of Adobe products simultaneously under Windows - why shouldn't that be possible? Currently I have CS3 and CS4 and somtimes use CS3 when CS4 is just too buggy to get the job done. Before that I had CS and CS2 on the same machine.
    But I wouldn't keep all versions back to PS 6.0 or CS, that would be a bit too chaotic and I'd had to spend days of installing if I get a new computer. I expect those programs to be a little bit backwards-compatible, so I don't have to use many different versions. And for Photoshop, this is mostly the case. It's just very tiny details like Smart Object resizing that seems to work differently.
    Otherwise I'm really happy that in CS4 I can finally link Masks to smart objects and apply warp and perspective on them, that's a big plus!

  • How to chnge cmyk and also apply color profiles in bridge

    Hi
    i want to apply color profile for selceted files in brige

    Does any one know how you can adjust the font size (point size) for the file
    names.
    Sadly enough you can't chance that, feel free to add a feature request for
    that, the more there ask for the bigger chance it will be realized.
    It would be great if the colors for the image name (background and font color)
    could be changed so the contrast could also be increased so it is also easier
    to read.
    And this the cheerful part, go to Bridge preferences General tap and play
    with the sliders for user interface and Image Backdrop until your satisfied.
    BTW using the slider for thumbnail size bottom right of the Bridge window to
    increase the thumbs does not increase the font but makes it nevertheless a
    little clearer.

  • Effect applied color bar on clips

    In Premiere Pro CC there is an "FX" box instead. Which is fine, but is there a way to make this appear before the clip name so that way I can always see it? Or turn the effect applied color bar back on? It was helpful when applying effects to a bunch of clips to know which ones still didn't have an effect.
    Hope there is a solution.

    You cannot change the way the clip name and fx box appear or turn the box on/off.
    When applying an effect to a clip the fx box turns purple just like it did with the color bar.
    If you like to see it different.
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • Apply color correction to the sequence, not clip

    Is it possible to select all clips in the sequence, then apply color corrector, or brightness/contrast filter _with a specific setting_ to the whole sequence?
    Currently when I select all in the sequence, apply a correction through effects > video ... etc, then change a setting, it will only change the setting one clip from the sequence.
    I know it is possible to work around this and do it with one clip and then paste attributes, but if there's another way, please let me know.
    Thank you!

    Michel,
    That's a great idea, why didn't I think of that? Thank you for your fast reply, I got it near instantly on the iPhone and was laughing at how simple and smart a solution you had!
    Cheers,
    Roman

  • Apply color in send mail body part

    Hi SAP Gurs,
    I am creating program for sending mail to user.. in that mail i so many header and line item are there, i want to apply color or bold, italic format in body part.... so its look like seprate in body part
    So is there any possibilty to apply color or bold words in mail body part?
    Please help me......
    Thanks zeni

    You can use the HTML text in the Message body part to get the Colors, Bold, Italics like effect in the mail.
    Please refer my answer in this post.
    formating possible in sending mail program
    Regards,
    Naimesh Patel

  • Using a script to get the color of a colorized Black & White Bitmap image

    I've been running into this wall for quite some time and would greatly appreciate any help that can given for it.
    I have an Illustrator script that runs inside of a BridgeTalk session within an InDesign script.  Yeah, it's complicated.  The upshot is that the Illustrator part opens up an EPS file, looks through all objects on a certain layer in that file, and returns an array of the colors used in it.  So, it looks at fill colors, stroke colors, gradient stops, etc.  One of the biggest stumbling blocks (next to PlugIn Items, which I'll ask about in a separate post) is getting the color of raster images.
    Most raster images, I realize, are going to be CMYK or RGB images, but our company mostly deals with either Grayscale images or Black & White Bitmaps that are embedded in the EPS file.  Those two allow the ability to colorize them by simply selecting them and then choosing a color, such as a spot PANTONE color from one of their color books.
    Now, I need the script to read the color that the raster image has been colorized with.  This works okay for images that have a GrayScale color space, as the script just looks at Colorant[0] of that image.  However, I run into a problem with Black & White Bitmap images.  Here's a piece of code that I try to make work with an EPS file that has a raster image:
    var document = app.activeDocument;
    for (var i = 0; i < document.layers[0].pageItems.length; i++) {
              // Stepping through each item on the layer.
              var currentItem = document.layers[0].pageItems[i];
              $.writeln("Current item is " + currentItem.typename);
              $.writeln("Number of channels is " + currentItem.channels);
              $.writeln("Color Space is " + currentItem.imageColorSpace);
              $.writeln("Colorized Grayscale? " + currentItem.colorizedGrayscale);
              $.writeln("Number of Colorants: " + currentItem.colorants.length);
              for (var j = 0; j < currentItem.colorants.length; j++)
                        $.writeln("Colorant number " + j + " is " + currentItem.colorants[j]);
              $.writeln("Its parent is " + currentItem.parent);
              $.writeln("Parent's typename is " + currentItem.parent.typename);
    This code runs successfully on an Illustrator file that has a Black & White Bitmap image on the top layer, but if you try and run it, you'll see the problem:  Even if you've colorized your Bitmap image with a PANTONE spot color (and the script even returns "true" on the line "Colorized Grayscale?"), Colorant number 0 is "Gray".  It should be the spot color assigned, not "Gray".
    Can anyone please help me figure out how to get the script to recognize the actual colorant of a Black & White Bitmap image in Illustrator?

    If you're a professional photographer with 50,000 pictures stored now and more coming all the time, you need to forget about using iPhoto and get yourself some professional-quality digital asset management software. iPhoto is not meant for people like you, and instead of providing a simple, elegant one-stop answer to all your needs, iPhoto is actually complicating your life.
    You need an application that will:
    - catalog ALL your images and keep track of where they are, no matter how many DVDs, folders, partitions or hard drives they're spread over;
    - display thumbnails of ALL of them, even when the DVD that contains them is not present in any drive, so you can select all the ones you want for a project;
    - find and copy (or export) the originals of all the files you've selected in the browser window, even if it means prompting you to insert the necessary DVDs for all of them.
    I suggest Googling "digital asset management software Macintosh" and seeing what turns up. I used to use an old version of Extensis Portfolio, and even that would have been better for your purposes than iPhoto is.

  • How to Apply Color to Placed .PNG file in AI_CS2 & keep Transparency?

    So unfortunately I'm stuck with CS2, but it sure beats not having it at all.
    I'm importing a graphic icon that was saved from Photoshop as a .PNG file with transparency into AI_CS2. (I can open the .PNG and resave it with any options or as a different format as suggested.)
    Once I import this image, I'd like to apply particular swatches to it. However, I find I can only apply a swatch after I've run LiveTrace. My problem is that after I've done so, I lose the transparency that is essential to this icon.
    Can anyone assist me? I'd be much indebted to you!
    FYI, ultimately I plan on saving this as a graphic .EPS to import into InDesign CS2.
    Thank you! Please let me know if there are any clarifications I can make.
    Peace,
    Carrie Anne
    CS2, MacOSX 10.4

    For ease of discussion, I'm just going to reveal the graphic here. I really think I ought to be able to color something so simple. I've gone back into Pshop & converted this to grayscale (the original was cut from something with color in it).
    After placing it in AI, I still can't apply a color, and once I run LiveTrace, if I apply a color, it colors the entire bounding box, not just the inside of the path. Same is true even if I choose MagicWand and select the inside area first. What else do I need to do? Is there a path option I need to choose after running LiveTrace? Thanks!
    (FYI, I'm inserting a .gif here b/c the .png file appeared with black in the background, and grey fill in the panther. This should be a black panther with a transparent background, if it doesn't work here, hopefully you get the point.)

  • Type mask of item in color is grayscale?

    I'm trying to make a mask of some bold type (like the example of the tiger in the masks section of the Motion 5 manual.) I can get the image to fit within the confines of the type, but it is in grayscale. The image that I'm using is colorful and I've tried every variable in the inspector to try to bring the color to life.
    Here's how I did it:
    I applied an image mask to the type layer.
    Then I dragged the layer of the graphic image to the well of the mask.
    As I said, it works but is gray. Thanks in advance.
    -steve

    Masks are either going to be "alpha" (transparency/opacity) or luminance (shade of grey.)
    You stated you added the Image Mask to the text and dragged the image into the mask source (and probably changed the Source Channel to luminance, which will produce the greyscale imaging.)
    To create "image-filled" text, you need to add the Image Mask to the tiger (or other image) and drag the text onto the mask. That way, your image will be masked by the text.

Maybe you are looking for