Display RGB values

Hello I am trying to display the RGB values of a color a user has chosen from a Hash Table, but I am confused and stuck on the syntax of using getRGB() method to display in a JTextArea method setText(). Just looking for a clue here is the line of code I am having trouble with:
displayRGB.setText((String)colorTable.get(input));
Thanks.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class ColorHashTable extends JFrame
  private JLabel inputLabel;
  private JTextField inputArea;
  private JButton goButton;
  private JTextArea displayRGB;
  private Hashtable colorTable;
  private JPanel southPanel;
  public ColorHashTable()
    super("Colors Using a Hash Table");
    //set up GUI
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    //set up North of window's Border Layout
    JPanel northPanel = new JPanel();
    inputLabel = new JLabel();
    northPanel.add(new JLabel ("Enter color number(1-10)"));
    inputArea = new JTextField(2);
    goButton = new JButton("Go");
    northPanel.add(inputArea);
    northPanel.add(goButton);
    //set up South of window's Border Layout
    southPanel = new JPanel();
    displayRGB = new JTextArea(2, 20);
    southPanel.add(displayRGB);
    container.add(northPanel, BorderLayout.NORTH);
    container.add(southPanel, BorderLayout.CENTER);
    //create Hash Table
    colorTable = new Hashtable();
    //add keys and color items to Hash Table
    colorTable.put("1",Color.BLUE);
    colorTable.put("2",Color.BLACK);
    colorTable.put("3",Color.CYAN);
    colorTable.put("4",Color.DARK_GRAY);
    colorTable.put("5",Color.GREEN);
    colorTable.put("6",Color.PINK);
    colorTable.put("7",Color.MAGENTA);
    colorTable.put("8",Color.ORANGE);
    colorTable.put("9",Color.YELLOW);
    colorTable.put("10",Color.RED);
    //actionListner
    goButton.addActionListener(
    new ActionListener()
      public void actionPerformed(ActionEvent event)
        if (event.getSource().equals(goButton))
          colorTheSouthPanelBackground();
    setSize(550, 130);
    setVisible(true);
  }//end constructor
  private void colorTheSouthPanelBackground()
    String input = inputArea.getText();
    southPanel.setBackground((Color)colorTable.get(input));
    displayRGB.setText((String)colorTable.get(input));
  public static void main(String[] args)
    ColorHashTable application = new ColorHashTable();
    application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

Your HashTable's values are Color objects not String objects. You can use getRGB() to get the actual RGB value or getRed(), getGreen(), getBlue() to get the individual values. How do you want format it? You'll have to convert it to a hex string (use Integer.toHexString()) if you want to show the common #RRGGBB format (i.e. #A35FDC). It might be a good practice to learn how you can separate out the red, green, and blue yourself using bitwise operators and a shift too.

Similar Messages

  • Why does my cell table not display color but RGB value

    Could somebody please suggest me.
    What I wanted is to let one collumn of a table display colors, but now they display the RGB values of the color not the colors.
    Please suggest me how I should do to get this done.
    Thanks.

    The renderer displays the toString() value of the Object stored in the table by default. If you want to display something else then you need to use a custom renderer
    The Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Tables explains what a renderer is and has an example that displays a color in a column.

  • How can I convert (or switch) the RGB percent values from the LR histogram into RGB values which are shown e. g. in PS/CameraRAW?

    In LR 5.5 (same in previous versions) the RGB values in the histogram are shown in percent (relativ) values. I prefere to see the absolute values, but I can`t find any way to switch. Maybe this option is intentional disabled, because LR works in 16-Bit mode this would result in values up to 2^16. But as i compared the relativ values from LR with the absolute values from PS i run into a conversion problem. The following example shows the differences:
    CameraRAW : RGB, 128,0,0
    Lightroom: RGB, 43,8%, 19,0%, 6,2%
    CameraRAW: RGB, 0,128,0
    Lightroom: RGB, 29,8%, 47,5%, 17,5%
    Mainly i have two questions:
    1. Is there any possibility to change the percent RGB values in LR to absolut values?
    2. How can i convert CameraRAW values to LR values (see above)?

    TThe reason that a design decision was made from the beginning of LR to show only the percentage values was that RGB values are dependent on the color space and the LR histogram and numerical readout are derived from the Develop module's display space which is a hybrid color space with ProPhoto RGB primaries and the sRGB TRC. Thus the numerical values in the display would be different from the exported RGB image (in an orthodox space) and it was feared that this would be misleading. When soft proofing was introduced, because it involved converting the display to an orthodox space, it became possible to use the 0-255 scale in that mode.

  • Legalities of color-and why are my RGB values inconsistent?

    Hi there,
    I have a client who is trying to trademark their logo and the RGB values. I have sent them the files and corresponding RGB values, but when they check the files in their mac Digital Color Meter they come up with different values. On my own computer, the values are consistent in the DCM and Photoshop, although I opened it on another computer and found that while the values were still correct when I open the files in Photoshop, the DCM values were incorrect there too.
    Does anybody have any history with this? Should I just tell them to ignore their DCM and that Photoshop is correct, or am I doing something wrong with profiles or something? It wouldn't be such a big deal but for the legal implications behind it...
    Thanks for any help!!
    Eli

    I was referring to "Scene Referred" CCchart Lab reference numbers derived from measurements taken of this chart from a spectrophotometer. You'll note the black patch is at L20 according to X-rite. The white patch is quite easy to attain L96 without clipping during exposure of the CCchart to build the profile from using DNG Profile Editor.
    What's not easy to control during exposure is the contrast ratio recorded by the camera. Adjusting the middle slider in Levels or the Contrast slider in ACR will show just how much contrast affects hue and saturation viewed on a display. Reality doesn't behave this way.
    Contrast/Luminance ratio's are disregarded or barely adjusted for in the DNG CCchart Wizard to come up with proper hue/saturation levels for each of the 18 color patches. The contrast adjusts required to get all 24 patches to match exactly (especially black at L20) makes the image not look right or follow a normal human visual response or perception.
    You can adjust contrast in the image after applying the new profile to get a reasonably correct look but quite a few of the 24 patches go off the charts according to the X-rite reference Lab numbers. The whole reason for going by the Lab numbers in profiling a device like a DSLR in the first place is to maintain consistency image to image by using measured results. As you can see this is not possible to achieve in a photograph except maybe in a controlled studio environment, but it does work when trying to match single spot colors that aren't influenced by the surround effect that affects human perception inherent in a photographed scene. A pleasing photograph is not about accurate numbers.
    A spectrophotometer is a static device that only reads and measures color wave lengths from color patches and converts them to Lab numbers. It's not a constantly adjusting device like our eyes which adapts to hue, saturation, color temp and contrast levels in any given scene.
    I'm going to post three images of a CCchart exposed under a high noon sun that I used to build two different DNG profiles. The first is using ACR default DNG converted source image and doing a straight dual illuminant table profile according to instructions. They're screenshots that include Apple's DCM to show how the black patch changes to accommodate exact Lab numbers as opposed to achieving a pleasing look. You'll note the more the image is made to "pop" the less accurate the Lab readouts and appearance.

  • DigitalColor Meter - RGB Values Don't Match?

    I've saved a 16 color palette under 'Colors' in the 'TextEdit' application. Each color has been set by directly typing in the values for R, G and B, for example one of the colors is R=68, G=255, B=153.
    If however I open the 'DigitalColor Meter' application, which is set to 'RGB As Actual Value, 8-bit' and move the aperture over the same color in the 'Colors' window the DigitalColor Meter reports the RGB values of that color differently to what was set. For the color mentioned above it reads R=73, G=250, B=151.
    Why don't the two match as they should? This happens with any color, but not black, white or a shade of grey.
    If I save an image from a website by draging the image to the desktop then open the image and use the DigitalColor Meter to compare the RGB values of any given pixel in the saved image to those of the same image displayed on the webpage then again the RGB values between the two will not quite match, but black, white or a shade of grey will.
    If however I save the image to my desktop by using >Apple-shift-4 to grab the image then the RGB values do match.
    Can someone explain exactly what's going on? Does it have something to do with perhaps OS X applying gamma correction to the screen so that any image displayed on the screen will have its RGB values slightly altered?
    If this is the case why isn't the DigitalColor meter affected or does it read a pixel's RGB values directly from graphics memory instead of screen memory where the gamma correction is being applied, not that I know how a Mac's graphics are organized, but I'm assuming anything to be displayed on the screen first has to be fetched from graphics memory.
    Powermac G4 Quicksilver Dual 1 GHz   Mac OS X (10.4.10)   1.5 GB SDRAM, 120 GB HD, 23" Cinema Display
    Powermac G4 Quicksilver Dual 1 GHz   Mac OS X (10.4.10)   1.5 GB SDRAM, 120 GB HD, 23" Cinema Display

    Well this is a day of debugging I'd rather have back.
    With a form of Rubber ducking my colleague helped me notice that the number of items being displaced was equal to the number of page zero item I added recently.
    These items were placed in my menu region, which happens to be region position 7.
    I had commented out a section of my page template
    <!--<header id="uHeader">
      <div class="apex_grid_container clearfix">
        <div class="apex_cols apex_span_12">
          #REGION_POSITION_07#
          <div class="logoBar">
            <h1><a href="#HOME_LINK#" id="uLogo">#LOGO#</a></h1>
            <div class="userBlock">
              <img src="#IMAGE_PREFIX#f_spacer.gif" class="navIcon user" alt="">
              <span>&APP_USER.</span>
              #NAVIGATION_BAR#
            </div>
          </div>
        </div>
      </div>
    </header>-->
    but this content was obviously still being generated.
    At some point during the page submission, this disturbed what apex was doing - somewhere these 'duplicated' yet commented field definitions were causing apex_application.accept to store the values in locations offset by the four P0 items.
    I often look to page zero for potential causes to strange issues - but this one initially beat me.

  • In the Info panel, how do I display pixel values as values, not as percentages?

    I'm trying to show, using the eye dropper tool, the actual values of pixels in an 8-bit grayscale image (Mode command confirms that's what's there). In the Info panel, the eye dropper tool displays percentages for every type of color information (K, CMYK), while the "8-bit" field remains blank.
    I've looked at Properties and pretty much everything else that I can find with no luck.
    Photoshop CS6, 64 bit, Win7-64
    Thanks!
    Ian J.

    Ian Jaffray wrote:
    Noel,
    Thanks for your reply. I thought this had been fixed by recreating the Preferences file, but this morning I was back to percentages. I did have different settings in the Info Panel from the ones in your very helpful picture, and after I changed mine to match yours I now see 0-255 values in the R, G, B settings when using the eyedropper on this grayscale image.
    Instead of RGB Color for the First Color Readout I had "Actual Color". This by itself causes percentages to be displayed. All options for the Second Color Readout all seem to produce percentages.
    "Actual Color" is what I normally use for the first readout. In the case of a Grayscale document, it will display a K (black) value. For a RGB image, it will display R,G and B values. And so on.
    When 8-bit is chosen for the value format, we expect a value of 0..255 to be displayed. As you know, that works fine for the RGB readout, but a Grayscale readout displays a percentage instead.
    So if you set one of the readouts to RGB and 8-bit, you can get 0..255 values to be displayed for your Grayscale document.
    When the document is Grayscale, the RGB values are a conversion from the document colour space to the RGB working space as defined in Edit > Color Settings. To get the true values of the pixels, the Grayscale document profile and RGB working space must be complementary (for lack of a better word). That's why, in my first reply, I said to use the following combinations:
    Doc with sGray profile and RGB working space of sRGB.
    Doc with Gray Gamma 2.2 profile and RGB working space of Adobe RGB.

  • Why is FrameMaker using different CYMK/RGB values for Pantone library colours compared with Illustrator?

    Evening all -
    this is by no means the first time I'm banged my head against the colour management brick wall, and I doubt it will be the last
    I am running Frame 12 and Illustrator CC on Windows 7.
    Both these Adobe products ship bundled with Pantone libraries. (Correct me with I'm wrong, but these "libraries" are basically a bunch of look-up tables, mapping named Pantone colours to various CYMK, RGB, etc equivalents?)
    Can anyone tell me why these two different Adobe applications appear to give different definitions for the same Pantone colours?
    For example, if I choose the Pantone Coated library > 'Warm Red'
    In Illustrator CC (left screenshot), it offers this as C0% M87.4% Y79.9% K0%
    in FrameMaker 12 (right screenshot), I get C0% M79%  Y91%  K0%
    Why are they different?
    Are the library definitions shipped with the products simply different?
    Frame's dialog ominously mentions "© Pantone, Inc., 1986, 1988"
    And if I go to C:\Program Files (x86)\Adobe\AdobeFrameMaker12\fminit\color and open the corresponding .bcf file in an editor, the header says:
    "BCF 2.0PANTONE¨ Coated 1.1 ©Pantone, Inc., 1986, 1988.PANTONE¨* Computer Video simulations displayed may not match PANTONE-identified solid color standards.  Use current PANTONE Color Reference Manuals for accurate color.  To order publications from Pantone, Inc., in the U.S. please call the toll-free number (800) 222-1149 [within NJ, call (201) 935-5500].  In other countries contact your local Pantone representative.  *Pantone, Inc.'s check-standard trademark for color.[1]"
    whereas if I go to C:\Program Files (x86)\Adobe\Adobe Illustrator CC\Presets\en_US\Swatches\Color Books and open the corresponding .acb swatch file in there, in amoungst the hex gibberish I note it says:
    "�=$$$/colorbook/PantonePlusCoated/title=PANTONE+^R Solid Coated/$$$/colorbook/PantonePlusCoated/prefix=PANTONE *$$$/colorbook/PantonePlusCoated/postfix= CK"$$$/colorbook/PantonePlusCoated/description=Copyright^C Pantone LLC, 2010"
    Have Pantone perhaps changed their colour definitions between 1988 and 2010?
    (I'm thinking it would be sensible to establish this one way or the other before we get into any convoluted discussions about the Windows GDI etc etc)

    David,
    What options did you use for defining the colours internally and what options for output in AI? I suspect that if you examine the EPS file you created from AI for the Panotne 355C, the only values in there are the CMYK ones - no LAB nor RGB. So FM has to use the algorithm mentioned in the other thread and creates the lime green based upon the algorithm. If you have set the AI drawing to an RGB color mode and set the EPS export option for "Include CMYK Postscript in RGB files" to OFF, then you would get the desired RGB values in the EPS file.
    If you're so intent on using Pantone Spot colours to get RGB, then you can create your own ACF library file with the exact RGB definitions that you want (you can then use whatever values you get in Photoshop, Illustrator or whatever source that you're trying to match). The structure of the file is as follows:
    ACF 1.0
    My Color Library             <----  name of library
    LibraryVersion: 1.0
    Copyright: © 2014 <your name here>. All rights reserved.
    AboutMessage: User defined Spot colours for RGB
    Names: Partial
    Rows: 4
    Columns: 4
    Entries: 1           <---- number of colours in file
    Prefix:         <---- used for display in FM, e.g. "Panotne"
    Suffix:           <----- used together with prefix, e.g. "CVC, CVU, etc."
    Type: Process <---- Spot, Process, Tint, Mixed (need to add specifier to Data lines)
    Models: CMYK RGB
    PreferredModel: RGB     <---- whatever you want
    Data:
    0.98 0.11 1.00 0.02              <---- CMYK values (0-1)
    0 38143 19967     <---- RGB values as 16-bit, i.e. 16-bit = ( [RGB value (1-255)]*256) + 255; zero is still zero
    Spruce Green                   <---- name of colour
    The acf file needs to be installed in the fminit\color folder.
    Also, a note of caution, If you screw something up in the acf file (like the incorrect number of entries in the file or you're missing a component value, this will hang FM if you use the View > Color > Definitions... option. You'll need to kill FM, fix or remove the ACF file and re-start. Also, FM only reads the libraries at the start, so if you need to make any changes to the ACF definitions, you have to r-start FM for those changes to take place.
    [I know, FM doesn't make it easy, but it can be done...]

  • Why I am getting different RGB Values in photoshop vs. Illustrator?

    The RGB values differ between Illustrator and Photoshop. The same file opened in photoshop displays different RGB values although the the colour was input correctly in illustrator. Both files were saved and reopened within the RGB colour space. There is a zero value in the desired RGB colour scheme, could this have something to do with it?

    RGB values relate to the color space used. The same color in sRGB and Adobe RGB will have very different numbers (and vice versa).
    There is no such thing as "RGB color space". That's a color mode, not a color space. There is only sRGB, Adobe RGB, ProPhoto RGB etc.

  • RGB values shifted by Keynote

    I'll start off by confirming that I'm running the lastest downloads of everything Apple software update has to offer.
    I've used the DigitalColor Meter to read RGB values for a colour that I've seen on a website and fancy using as a background for my Keynote presentations. The values are incidental, I guess, but here they are: 241, 241, 213. Welcome to putty.
    In Keynote, I've put these figures into the RGB control box and yet to my eyes while the colour created is close to my target, it is obviously not the same.
    When I use DigitalColor Meter to read the values of what Keynote has actually created, it shows 239, 248, 218. This is while Keynote simultaneously shows that the colour I am using is exactly the one for which I've given it the figures 241, 241, 213.
    This clearly isn't a monitor calibration problem, but a Keynote-not-reading-its-own-colour-input-boxes problem!
    Just to be double-sure, I've set Keynote to use a suitably coloured Word page as its background image and, unsurprisingly, the DigitalColor Meter shows that Keynote can show 241, 241, 213.
    I'm sure that I've done this in the past without this hiccough. Any suggestions, please?
    Thanks
    Brinley
    MacBook C2D 2Ghz   Mac OS X (10.4.9)  
    MacBook   Mac OS X (10.4.9)  

    The RGB figures for the colour that the Keynote generates from the 'magnifying-glass' method rather than 'manual input' method match the target website colour exactly: 241, 241, 213. Keynote thinks it is reproducing these figures and DigitalColor Meter confirms that it actually is ... the values are no longer 'shifted' in the way that prompted my question.
    You've almost certainly asked a question which is at the centre of this, though: I forgot that I bought a Huey colour-calibration device and so my display is now set to whatever that thought best. The colour profile that that device has generated is way better than the Mac default, which set the contrast much too high (everything was both washed out and neon at the same time, somehow) and blue-tinged.
    This explains why I got the manual input method to work before--that predates my purchase of the Huey.
    Thanks for your prompt and clear input!
    MacBook   Mac OS X (10.4.9)  

  • How to find RGB values of an image in MIDP 2.0?

    I am builiding a midlet in which i m supposed to take an image and than i want to find RGB values of all pixels
    .After Finding the RGB values i want to store them in an array,and sort that array to find 5 Most repeated element of that array.Also i wanna construct color from those 5 Values and Display Those Colors.Can Anyone
    Guide me Through This?

    I have not used Vision much but I would be very surprised if you would be able to do this directly.  It should be straight forward to get an average intensity with or without Vision (convert image to 2D matrix and average the values, for instance) -- the difficulty will be correlating the calculated values back to Lumens, etc. This could likely be done but it would probably require you to come up with the calibration curve and would be sensitive to setup changes, dust on the lens, equipment aging, etc. and these things should not be discounted.  This is why, particularly if  you're in a production environment, you'd probably better off buying a commercial meter and talking to it via a driver than to try to do it yourself -- they've already taken these things into account. 
    One more thing, in the picture you attached, any luminosity calculations you made would probably be skewed low as the white is saturated (railed) in spots and those under-reported values would affect your average.  If you did try to come up with a Lumen calculation, you would probably want to turn your aperature and/or exposure down before creating the calibration curve.

  • RGB values (eyedropper) where ot find in Aperture?

    Where can I find the eyedropper tool in Aperture? I want to check if in fact my greys are neutral... Can't seem to find it!

    Although Aperture does not have this built in (an
    oversight to be sure) there actually is a pretty good
    alternative shipped with every Mac.
    Actually, it’s useless for the task. It’s NOT providing RGB values of the image data but the color sent to the display. We need RGB values of either the internal HDR color space (that is being represented by the Histogram) and/or (better) whatever output color space you need to export the files. Aperture provides neither which in my mind is very confusing.
    While many have said Aperture is lacking due to lack of curves, the lack of an info palette is a far bigger issue.
    It would also be lovely if the Histogram would represent the rendered data based on my selection for a color space I’ll encode the data. Adobe Camera RAW provides this (toggle the output color spaces and watch the Histogram update). Not the case in Aperture. So I have no idea, based on the gamut of the scene if I want to encode in ProPhoto RGB or Adobe RGB (1998). If scene gamut fits within Adobe RGB (1998), I'd rather not use ProPhoto RGB. In Aperture, I’m flying blind.

  • RGB values of current terminal color settings?

    The colors displayed for different ANSI escape codes are configurable via .Xdefaults or directly on the command line via other ANSI escapes.
    Is there any way to dump the current values from a terminal? For example, given the ANSI escape code "\033[31m", I would like to know the current RGB values used to display it.
    Obviously this will depend on the terminal (e.g. urxvt can have different settings from xterm), but I'm hoping that there is some obscure tool to do this.

    Coincidentally, I recently wrote a script to do exactly this: query all the color values from a terminal emulator and show them in a nice table. I was planning to make a thread for this, but this thread is perfect.  In my opinion, the strategy of querying colors from the terminal itself is superior (when it is supported by the terminal) to mucking around with .Xresources, .Xdefaults, or "xrdb --query", which only work in pretty limited situations. The drawbacks of my approach are: (1) it can be challenging to make the same code work on different terminal emulators, and (2) you have to use it from the terminal you want to query, and not from within a screen or tmux session. (I think there may be partial workarounds for (2), but I haven't implemented them.) I've tested my code on a number of terminals, and the upshot is that xterm and urxvt are supported flawlessly, and VTE-based terminals like gnome-terminal and XFCE's "Terminal" are almost fully supported. (I wasn't able to query the default foreground and background colors, but everything else seems to work.) Most other X terminals don't seem to support this method of querying color values.
    Here's an example of what the script produces:
    Obviously, that's a heavily formatted table, but I think the code has enough comments that you can take what you need from it. It works under python 3 or python 2.7.
    Edit: This version is superseded by the one in post #27, which is structured better. I'm leaving this here since some of the future replies refer to it.
    #!/usr/bin/python
    This is a Python script to show off your terminal ANSI colors (or more
    colors, if your terminal has them). It works on both Python 2.7 and
    Python 3.
    This script must be run from the terminal whose colors you want to
    showcase. Not all terminal types are supported (see below). At the
    very minimum, 16-color support is required.
    Fully supported terminals:
    xterm
    urxvt
    For these terminals, this script can show a color table with correct RGB
    values for each color. It queries the RGB values from the terminal
    itself, so it works even if you change the colors after starting the
    terminal.
    Mostly supported terminals: pretty much all VTE-based terminals. This
    includes:
    vte
    Terminal (XFCE)
    gnome-terminal
    terminator
    tilda
    and many more. These are on "mostly" status because I don't know how to
    query their foreground and background colors. Everything else works,
    though, albeit with noticeable slowness (which may be beyond this
    script's control).
    Somewhat supported terminals: pretty much all other X-client terminals
    I've tried. These include:
    konsole (KDE)
    terminology (Enlightenment)
    Eterm (Enlightenment)
    (etc.)
    For these terminals, the script can output a color table just fine, but
    without RGB values.
    Unsupported terminals:
    ajaxterm
    Linux virtual console (i.e., basic TTY without X-windows)
    Warning: do not run this script on the Linux virtual console unless you
    want a garbled TTY! That said, you can still type `tput reset<Enter>'
    afterward to get back to a usable console. :-) The situation with
    ajaxterm is similar, but not as bad.
    If a terminal isn't mentioned here, I probably haven't tried it. Attempt
    at your own risk!
    Note regarding screen/tmux: this script can theoretically be run from a
    screen or tmux session, but you will not get any RGB values in the
    output (indeed, a screen session can be opened on multiple terminals
    simultaneously, so there typically isn't a well defined color value for
    a given index). However, it's interesting to observe that screen and
    tmux emulate a 256 color terminal independently of the terminal(s)
    to which they are attached, which is very apparent if you run the script
    with 256-color output on a screen session attached to a terminal with 8-
    or 16-color terminfo (or with $TERM set to such).
    This code is licensed under the terms of the GNU General Public License:
    http://www.gnu.org/licenses/gpl-3.0.html
    and with absolutely no warranty. All use is strictly at your own risk.
    from sys import stdin, stdout, stderr
    import re
    import select
    import termios
    from collections import defaultdict
    from argparse import (ArgumentParser, ArgumentError)
    # Operating system command
    osc = "\033]"
    # String terminator
    # ("\033\\" is another option, but "\007" seems to be understood by
    # more terminals. Terminology, for example, doesn't seem to like
    # "\033\\".)
    st = "\007"
    # Control sequence introducer
    csi = "\033["
    # ANSI SGR0
    reset = csi + 'm'
    # Errors that may be raised by rgb_query
    num_errors = 0
    class InvalidResponseError(Exception):
    The terminal's response couldn't be parsed.
    def __init__(self, q, r):
    global num_errors
    num_errors += 1
    Exception.__init__(self, "Couldn't parse response " + repr(r) +
    " to query " + repr(q))
    class NoResponseError(Exception):
    The terminal didn't respond, or we were too impatient.
    def __init__(self, q):
    global num_errors
    num_errors += 1
    Exception.__init__(self, "Timeout on query " + repr(q))
    # Wrappers for xterm & urxvt operating system controls.
    # These codes are all common to xterm and urxvt. Their responses aren't
    # always in the same format (xterm generally being more consistent), but
    # the regular expression used to parse the responses is general enough
    # to work for both.
    # Note: none of these functions is remotely thread-safe.
    def get_fg(timeout):
    Get the terminal's foreground (text) color as a 6-digit
    hexadecimal string.
    return rgb_query([10], timeout)
    def get_bg(timeout):
    Get the terminal's background color as a 6-digit hexadecimal
    string.
    return rgb_query([11], timeout)
    def get_color(a, timeout):
    Get color a as a 6-digit hexadecimal string.
    return rgb_query([4, a], timeout)
    def test_fg(timeout):
    Return True if the terminal responds to the "get foreground" query
    within the time limit and False otherwise.
    return test_rgb_query([10], timeout)
    def test_bg(timeout):
    Return True if the terminal responds to the "get background" query
    within the time limit and False otherwise.
    return test_rgb_query([11], timeout)
    def test_color(timeout):
    Return True if the terminal responds to the "get color 0" query
    within the time limit and False otherwise.
    return test_rgb_query([4, 0], timeout)
    def test_rgb_query(q, timeout):
    Determine if the terminal supports query q.
    Arguments: `q' and `timeout' have the same interpretation as in
    rgb_query().
    Return: True if the terminal gives a valid response within the
    time limit and False otherwise.
    This function will not raise InvalidResponseError or
    NoResponseError, but any other errors raised by rgb_query will
    be propagated.
    try:
    rgb_query(q, timeout)
    return True
    except (InvalidResponseError, NoResponseError):
    return False
    # String to use for color values that couldn't be determined
    rgb_placeholder = '??????'
    # This is what we expect the terminal's response to a query for a color
    # to look like. If we didn't care about urxvt, we could get away with a
    # simpler implementation here, since xterm and vte seem to give pretty
    # consistent and systematic responses. But I actually use urxvt most of
    # the time, so....
    ndec = "[0-9]+"
    nhex = "[0-9a-fA-F]+"
    crgb = ("\033\\]({ndec};)+rgba?:" +
    "({nhex})/({nhex})/({nhex})(/({nhex}))?").format(**vars())
    re_response = re.compile(crgb)
    # The problem I'm attempting to work around with this complicated
    # implementation is that if you supply a terminal with a query that it
    # does not recognize or does not have a good response to, it will simply
    # not respond *at all* rather than signaling the error in any way.
    # Moreover, there is a large variation in how long terminals take to
    # respond to valid queries, so it's difficult to know whether the
    # terminal has decided not to respond at all or it needs more time.
    # This is why rgb_query has a user-settable timeout.
    P = select.poll()
    P.register(stdin.fileno(), select.POLLIN)
    def flush_input():
    Discard any input that can be read at this moment.
    repeat = True
    while repeat:
    evs = P.poll(0)
    if len(evs) > 0:
    stdin.read()
    repeat = True
    else:
    repeat = False
    def rgb_query(q, timeout=-1):
    Query a color-valued terminal parameter.
    Arguments:
    q: The query code as a sequence of nonnegative integers, i.e.,
    [q0, q1, ...] if the escape sequence in pseudo-Python is
    "\033]{q0};{q1};...;?\007"
    timeout: how long to wait for a response. (negative means
    wait indefinitely if necessary)
    Return: the color value as a 6-digit hexadecimal string.
    Errors:
    NoResponseError will be raised if the query times out.
    InvalidResponseError will be raised if the terminal's
    response can't be parsed.
    See
    http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
    ("Operating System Controls") to see the various queries
    supported by xterm. Urxvt supports some, but not all, of them,
    and has a number of its own (see man -s7 urxvt).
    Warning: before calling this function, make sure the terminal is
    in noncanonical, non-blocking mode.
    query = osc + ';'.join([str(k) for k in q]) + ';?' + st
    flush_input()
    stdout.write(query)
    stdout.flush()
    # This is addmittedly flawed, since it assumes the entire response
    # will appear in one shot. It seems to work in practice, though.
    evs = P.poll(timeout)
    if len(evs) == 0:
    raise NoResponseError(query)
    r = stdin.read()
    m = re_response.search(r)
    if not m:
    raise InvalidResponseError(query, r)
    # (possibly overkill, since I've never seen anything but 4-digit RGB
    # components in responses from terminals, in which case `nd' is 4
    # and `u' is 0xffff, and the following can be simplified as well
    # (and parse_component can be eliminated))
    nd = len(m.group(2))
    u = int('f'*nd, 16)
    # An "rgba"-type reply (for urxvt) is apparently actually
    # rgba:{alpha}/{alpha * red}/{alpha * green}/{alpha * blue}
    # I opt to extract the actual RGB values by eliminating alpha. (In
    # other words, the alpha value is discarded completely in the
    # reported color value, which is a compromise I make in order to get
    # an intuitive and compact output.)
    if m.group(5):
    # There is an alpha component
    alpha = float(int(m.group(2), 16))/u
    idx = [3, 4, 6]
    else:
    # There is no alpha component
    alpha = 1.0
    idx = [2, 3, 4]
    c_fmt = '%0' + ('%d' % nd) + 'x'
    components = [int(m.group(i), 16) for i in idx]
    t = tuple(parse_component(c_fmt % (c/alpha)) for c in components)
    return "%02X%02X%02X" % t
    def parse_component(s):
    Take a string representation of a hexadecimal integer and transorm
    the two most significant digits into an actual integer (or double
    the string if it has only one character).
    n = len(s)
    if n == 1:
    s += s
    elif n > 2:
    s = s[:2]
    return int(s, 16)
    def test_num_colors(timeout):
    Attempt to determine the number of colors we are able to query from
    the terminal. timeout is measured in milliseconds and has the same
    interpretation as in rgb_query. A larger timeout is safer but will
    cause this function to take proportionally more time.
    if not test_color(timeout):
    return 0
    a = 0
    b = 1
    while test_rgb_query([4, b], timeout):
    a = b
    b += b
    while b - a > 1:
    c = (a + b)>>1
    if test_rgb_query([4, c], timeout):
    a = c
    else:
    b = c
    return b
    class ColorDisplay(object):
    Class for producing a colored display of terminal RGB values.
    def __init__(self, timeout=100, color_level=3, do_query=True):
    timeout: same interpretation as in rgb_query. A larger timeout
    will be used a small number of times to test the
    capabilities of the terminal.
    color_level: how much color should be in the output. Use 0 to
    suppress all color and 3 or greater for maximum coloredness.
    do_query: whether to attempt to query RGB values from the
    terminal or just use placeholders everywhere
    self.timeout=timeout
    self.color_level=color_level
    # try getting the rgb value for color 0 to decide whether to
    # bother trying to query any more colors.
    self.do_query = do_query and test_color(self.timeout*5)
    def none_factory():
    return None
    # colors for highlighting
    self.hi = defaultdict(none_factory)
    self.hi['['] = 10
    self.hi[']'] = 10
    self.hi['+'] = 9
    self.hi['/'] = 9
    for c in '0123456789ABCDEF':
    self.hi[c] = 12
    def show_ansi(self):
    Show the 16 ANSI colors (colors 0-15).
    color_order = [0, 1, 3, 2, 6, 4, 5, 7]
    names = [' Black ', ' Red ', ' Green ', ' Yellow ',
    ' Blue ', ' Magenta', ' Cyan ', ' White ']
    stdout.write(self.fgcolor('15', 3))
    for k in range(8):
    a = color_order[k]
    stdout.write(names[a])
    stdout.write('\n')
    stdout.write(self.fgcolor(None, 3))
    c = None
    for k in range(8):
    a = color_order[k]
    c = self.hiprint(' [%X/%X] ' % (a, 8 + a), c)
    stdout.write('\n')
    self.show_color_table([0,8], color_order)
    def show_color_cube(self, n):
    Show the "RGB cube" (xterm colors 16-231 (256-color) or 16-79
    (88-color)). The cube has sides of length 6 or 4 (for 256-color
    or 88-color, respectively).
    base = {256:6, 88:4}[n]
    c = None
    c = self.hiprint('[ + ] ', c)
    for w in range(base):
    c = self.hiprint('[%X] ' % w, c)
    stdout.write('\n\n' + self.fgcolor(None, 3))
    for u in range(base):
    for v in range(base):
    stdout.write(' '*v)
    x = (u*base + v)*base
    self.hiprint(' [%02X] ' % (16 + x))
    for w in range(base):
    self.show_color(x + w + 16)
    stdout.write('\n')
    stdout.write('\n\n')
    def show_grayscale_ramp(self, end):
    Show the "grayscale ramp" (xterm colors 232-255 (256-color) or
    80-87 (88-color)).
    start = {256:232, 88:80}[end]
    n = end - start
    vals = [self.get_color(a) for a in range(start, end)]
    #stdout.write(reset)
    c = None
    c = self.hiprint('[ ', c)
    for v in range(n):
    c = self.hiprint('%02X ' % (start + v), c)
    c = self.hiprint(']\n', c)
    stdout.write('\n ' + self.fgcolor(None, 3))
    for v in range(n):
    stdout.write(' ' + self.block(start + v, 2))
    stdout.write('\n ')
    for u in range(3):
    for v in range(n):
    stdout.write(' ')
    stdout.write(self.fgcolor(start + v, 2))
    stdout.write(vals[v][2*u : 2*(u + 1)])
    stdout.write(self.fgcolor(None, 2))
    stdout.write('\n ')
    stdout.write('\n')
    def show_colors(self, n):
    Make a table showing colors 0 through n-1.
    self.show_color_table(range(0,n,8), range(8), n, True)
    def show_color_table(self, rows, cols, stop=-1, label=False):
    Make a color table with all possible color indices of the form
    rows[k] + cols[j] that are less than `stop' (if `stop' is not
    negative). If label is True, then print row and column labels.
    if label:
    self.hiprint('[ + ]')
    stdout.write(self.fgcolor(None, 3))
    for a in cols:
    stdout.write(' ' + self.octal(a) + ' ')
    stdout.write('\n')
    if label:
    stdout.write(' ')
    stdout.write('\n')
    for b in rows:
    if label:
    stdout.write(self.octal(b) + ' ')
    for a in cols:
    c = a + b
    if stop < 0 or c < stop:
    self.show_color(b + a)
    else:
    stdout.write(' ')
    stdout.write('\n')
    stdout.write('\n')
    def show_color(self, a):
    Make a pretty display of color number `a', showing a block of
    that color followed by the 6-character hexadecimal code for the
    color.
    stdout.write(' ' + self.block(a) + ' ')
    stdout.write(self.fgcolor(a, 2) + (self.get_color(a)))
    stdout.write(self.fgcolor(None, 2))
    def hiprint(self, s, last_color=-1):
    Print s to stdout, highlighting digits, brackets, etc. if the
    color level allows it.
    Arguments:
    s: the string to print.
    last_color: the current terminal foreground color. This
    should be `None' if no color is set, or the current
    color index, or something else (like a negative integer)
    if the color isn't known. (The last option is always
    safe and will force this function to do the right
    thing.)
    Return: the current foreground color, which can be passed as
    last_color to the next call if the color isn't changed in
    between.
    for c in s:
    if c == ' ':
    color = last_color
    else:
    color = self.hi[c]
    if color != last_color:
    stdout.write(self.fgcolor(color, 3))
    stdout.write(c)
    last_color = color
    return last_color
    def octal(self, x):
    Return a base-8 string for the integer x, highlighted if the
    color level allows it.
    return self.fgcolor(self.hi['+'], 3) + '0' + \
    self.fgcolor(self.hi['0'], 3) + ('%03o' % x)
    def block(self, c, n=1):
    Return a string that prints as a block of color `c' and size `n'.
    return self.bgcolor(c, 1) + ' '*n + self.bgcolor(None, 1)
    # Changing the foreground and background colors.
    # While the 38;5 and 48;5 SGR codes are less portable than the usual
    # 30-37 and 40-47, these codes seem to be fairly widely implemented (on
    # X-windows terminals, screen, and tmux) and support the whole color
    # range, as opposed to just colors 0-8. They also make it very easy to
    # set the background to a given color without needing to mess around
    # with bold or reverse video (which are hardly portable themselves).
    # This is useful even for the 16 ANSI colors.
    def fgcolor(self, a=None, level=-1):
    Return a string designed to set the foreground color to `a' when
    printed to the terminal. None means default.
    if self.color_level >= level:
    if a is None:
    return csi + '39m'
    else:
    return csi + '38;5;' + str(a) + 'm'
    else:
    return ''
    def bgcolor(self, a=None, level=-1):
    Return a string designed to set the background color to `a' when
    printed to the terminal. None means default.
    if self.color_level >= level:
    if a is None:
    return csi + '49m'
    else:
    return csi + '48;5;' + str(a) + 'm'
    else:
    return ''
    def get_color(self, a):
    if self.do_query:
    try:
    return get_color(a, timeout=self.timeout)
    except (InvalidResponseError, NoResponseError):
    return rgb_placeholder
    else:
    return rgb_placeholder
    # Command-line arguments
    timeout_dft = 200
    parser = ArgumentParser(
    description="Python script to show off terminal colors.",
    epilog="Run this script from the terminal whose colors " +
    "you want to showcase. " +
    "For a brief synopsis of which terminal types are " +
    "supported, see the top of the source code.")
    mode_group = parser.add_mutually_exclusive_group()
    p_choices = [16, 88, 256]
    arg_p = mode_group.add_argument(
    '-p', '--pretty',
    action='store_true', default=False,
    help="show colors 0 through N-1 in a pretty format. " +
    ("N must belong to %r. " % p_choices) +
    "If N > 16, it should be the actual number of colors " +
    "supported by the terminal, or the output will almost " +
    "certainly not be pretty.")
    mode_group.add_argument(
    '-f', '--flat',
    action='store_true', default=False,
    help="show a simple table with colors 0 through N-1. ")
    parser.add_argument(
    'n', nargs='?', metavar='N',
    type=int, default=16,
    help="number of colors to show. " +
    "Unless you explicitly supply -p/--pretty or -f/--flat, " +
    "--pretty is used if possible and --flat is used " +
    "otherwise. " +
    "N defaults to 16, showing the ANSI colors 0-15. " +
    "If N is 0, the script will attempt to determine the " +
    "maximum number of colors automatically " +
    "(which may be slow).")
    parser.add_argument(
    '--no-fgbg',
    action='store_false', dest='fgbg', default=True,
    help="suppress display of foreground/background colors.")
    parser.add_argument(
    '--no-query',
    action='store_false', dest='do_query', default=True,
    help="don't try to query any RGB values from the terminal " +
    "and just use placeholders.")
    parser.add_argument(
    '-t', '--timeout', metavar='T',
    type=int, default=timeout_dft,
    help="how long to wait for the terminal to "
    "respond to a query, in milliseconds " +
    "[default: {0}]. ".format(timeout_dft) +
    "If your output has '?' characters " +
    "instead of RGB values " +
    "or junk printed after the script runs, " +
    "increasing this value may or may not " +
    "help, depending on the terminal. " +
    "A negative T will behave like infinity.")
    parser.add_argument(
    '-l', '--level', metavar='L',
    type=int, default=3,
    help="choose how much color to use in the output. " +
    "(0 = no color; 3 = most color [default])")
    if __name__ == '__main__':
    args = parser.parse_args()
    assert not (args.pretty and args.flat)
    if args.pretty:
    if args.n not in p_choices:
    raise ArgumentError(
    arg_p,
    "N must belong to %r" % p_choices)
    tc_save = None
    try:
    tc_save = termios.tcgetattr(stdout.fileno())
    tc = termios.tcgetattr(stdout.fileno())
    # Don't echo the terminal's responses
    tc[3] &= ~termios.ECHO
    # Noncanonical mode (i.e., disable buffering on the terminal
    # level)
    tc[3] &= ~termios.ICANON
    # Make input non-blocking
    tc[6][termios.VMIN] = 0
    tc[6][termios.VTIME] = 0
    termios.tcsetattr(stdout.fileno(), termios.TCSANOW, tc)
    if args.n == 0:
    args.n = test_num_colors(args.timeout)
    # We are guaranteed to have failed some queries now, but
    # that isn't meaningful.
    num_errors = 0
    if not (args.pretty or args.flat):
    if args.n in p_choices:
    args.pretty = True
    else:
    args.flat = True
    if args.level >= 1:
    stdout.write(reset)
    if args.fgbg:
    if args.do_query:
    try:
    bg = get_bg(timeout=args.timeout)
    except (InvalidResponseError, NoResponseError):
    bg = rgb_placeholder
    try:
    fg = get_fg(timeout=args.timeout)
    except (InvalidResponseError, NoResponseError):
    fg = rgb_placeholder
    else:
    bg = rgb_placeholder
    fg = rgb_placeholder
    stdout.write("\n Background: %s\n" % bg)
    stdout.write(" Foreground: %s\n\n" % fg)
    C = ColorDisplay(args.timeout, args.level, args.do_query)
    if args.pretty:
    assert args.n in p_choices
    stdout.write('\n ANSI colors:\n\n')
    C.show_ansi()
    if args.n > 16:
    stdout.write('\n RGB cube:\n\n')
    C.show_color_cube(args.n)
    stdout.write(' Grayscale ramp:\n\n')
    C.show_grayscale_ramp(args.n)
    else:
    C.show_colors(args.n)
    if num_errors > 0:
    stderr.write("Warning: not all queries succeeded\n" +
    "Warning: (output contains " +
    "placeholders and may be inaccurate)\n")
    finally:
    if args.level >= 1:
    stdout.write(reset)
    flush_input()
    if tc_save != None:
    termios.tcsetattr(stdout.fileno(),
    termios.TCSANOW, tc_save)
    Run it as
    python showcolors.py -h
    to get an overview of the functionality.
    TL;DR: you can echo a string like "\033]4;13;?\007" to an xterm, and it will output the RGB value of color #13 to itself in the form "\033]4;13;rgb:rrrr/gggg/bbbb\007", which you can then read and parse. To try it out:
    $ echo -en "\033]4;13;?\007"
    There are some subtleties if you want this to work on other terminals like urxvt; for that you can experiment yourself or read the code. 
    Further reading: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html (heading "Operating System Controls").
    Xyne, regarding determining the number of colors: I don't know how to do that completely reliably. You can try simply
    tput colors
    but this relies on the value of $TERM and its terminfo and thus may be unreliable. A kludgy but workable way to do this using the "rgb_query" function in my script is to query color values using binary search to find the highest color value the terminal will allow you to query. The main problem with this is that if you query an invalid color index, then the terminal just won't respond at all, and if you query a valid index, it will respond but after a somewhat unpredictable delay, so it's hard to know for sure which one is the case. Like I said, it's kludgy but workable.
    Edit: I went ahead and added that functionality to my script. Try running it as
    python showcolors.py 0
    or look at the function "test_num_colors".
    Last edited by Lux Perpetua (2012-10-22 11:18:21)

  • RGB Values & Powerpoint

    Hi, this may be too basic of a question for this forum, but for a particular Kuler scheme I would like to know the RGB values for each of the colors. My intent is to manually apply certain colors to elements in a power point presentation.
    So, help displaying RGB codes would be appreciated. And/if anyone has any tips getting the colors into powerpoint I could use the help.
    Thanks
    Scott A.

    If you were to have Adobe Photoshop or illistrator or even one of the suites you could get these values.  There are so many of them we are talking million  in an 8 bit image.  Now if you were to just want your basic red green and blue values there are millions.  The other thing is how they are applied in Power point.  I reccomend you visit kuhler for all the pantone colors.  Then visit Lynda.com on color correction and working with color.  They all start with the basic break down of how RGB applied.  This is cool what you are studying and think if you visit the two places mentioned especially working with color in photoshop it will show you the theory your looking for and how you could demonstrate it in another program.  Then Calibration is huge to make your numbers look like the color you want to represent.  I hope this helps you I have delved into that subject quite a bit lately and when you demonstrate your values make sure your monitor is calibrated so that when you play power point your values and colors are good.  There are monitor calibrators on the net and you may have one on your computer for your monitor.  I used the Color Munki that calibrates my printer and monitor.  It displays well in accross all my applications.

  • RGB values when scaling

    Hello,
    My problem is - I have an image displayed on a label
    JLabel label = new JLabel(new ImageIcon(shapeIcon));
    And I am retrieving the pixel value through a mouse event
    int positionX = mouseEvent.getX();
    int positionY = mouseEvent.getY();
    int pixelSource = bufferedShape.getRGB(positionX, positionY);
    This works fine until I scale the image as follows on the display
    JLabel label = new JLabel(new ImageIcon(shapeIcon.getScaledInstance(200, 200, 0)));
    Now when I click on the image I get an error thrown at this line
    int pixelSource = bufferedShape.getRGB(positionX, positionY);
    Any ideas.
    Thanks,
    Enda

    OK sorry.
    Here is the part of the UI code
    public void displayShape()
    //Image location
    buildConstraints(constraints,0,0,1,0,100,100);
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(6,6,6,6);
    JLabel label = new JLabel(new ImageIcon(shapeIcon.getScaledInstance(200, 200, 0)));
    // label.setIcon(new ImageIcon(shapeIcon));
    lm.setConstraints(label, constraints);
    pane.add(label);
    And here is the Mouse listener
    class LabelMouseListener extends MouseAdapter
    public void mouseClicked(MouseEvent mouseEvent)
    //Get the X and Y position of the Mouse
    int positionX = mouseEvent.getX();
    int positionY = mouseEvent.getY();
    //Get the RGB value of the pixel at x,y on the BufferedImage
    int pixelSource = bufferedShape.getRGB(positionX, positionY);
    // Create the Color Object
    Color colour = new Color(pixelSource);
    // Get the Red values (only need red value as it is a B & W image)
    int red = colour.getRed();
    if (colour.getRed() == 0)
    label2.setText("Black Pixel value 0 at ("
    positionX ", " positionY ")");
    else
    label2.setText("White Pixel value 255 at ("
    positionX ", " positionY ")");
    And the error
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException
         at sun.awt.image.IntegerInterleavedRaster.getDataElements(IntegerInterleavedRaster.java:202)
         at java.awt.image.BufferedImage.getRGB(BufferedImage.java:763)
         at jamesproject.Shape$LabelMouseListener.mouseClicked(Shape.java:542)
         at java.awt.Component.processMouseEvent(Component.java:3718)
         at java.awt.Component.processEvent(Component.java:3544)
         at java.awt.Container.processEvent(Container.java:1164)
         at java.awt.Component.dispatchEventImpl(Component.java:2593)
         at java.awt.Container.dispatchEventImpl(Container.java:1213)
         at java.awt.Component.dispatchEvent(Component.java:2497)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2230)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
         at java.awt.Container.dispatchEventImpl(Container.java:1200)
         at java.awt.Window.dispatchEventImpl(Window.java:914)
         at java.awt.Component.dispatchEvent(Component.java:2497)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    THANKS.
    Enda

  • How does Photoshop convert LAb to RGB values?

    I'm working on a project and the only way to obtain RGB or LAB values is my using the color picker. I don't want to have to do that manually everytime i need an lab to be converted to a photoshop RGB. I need to know how that is computed.

    First, there's no such ting as "RGB" to convert to, only specific RGB color spaces such as sRGB, Adobe RGB or ProPhoto. You get different values in all of them.
    As it happens Lab values are always available through the Color Management Module. Lab is one of two profile connection spaces used in all color management operations (the other is CIE XYZ). For instance, as you view the image on screen the RGB values in the file are constantly calculated as document profile > Lab (or XYZ) > display profile.
    These are complex calculations and good luck doing it manually. The easy way is to use the color picker.

Maybe you are looking for

  • Group Policy Client service failed! Help!

    A few days ago I was booted out of my account, while watching a DVD. My system restarted itself, but not before flashing some sort of blue screen. Unfortunately I was unable to read the content of it. After restarting, I was presented with a light bl

  • OSX in virtual box

    Is there a way to create a disk image of osx, preferably clean, to run in virtual box? I would like to use this disk image to run sketchy software before i run it on my real copy of osx therefore (hopefully) avoiding viruses and keeping my personal i

  • Items in trash are invisible.

    It seems that the items in the Aperture trash are invisible. They're there and delete-able, but the window is empty. Also the In the last week window is empty. Any ideas?

  • Issues with Samsung SSD after Mavericks

    I bought a Samsung SSD 830 in the Summer of 2011 (for my Mid 2010 MacBook Pro), and it's been working fantastically until I upgraded to Mavericks. What's peculiar is that my computer works fine when it's plugged in to my Time Machine external HD via

  • Error -200279 in DAQmx

    Hi all,  I am using NI PCI-6251 on Labwindows. Basically i am acquiring two analog signals one of freq 200 Hz and the other of freq 1 KHz using "ContAcqIntClk" example that is shipped with CVI. The problem is that on the default settings that are Sam