Colorsysplus: Python 3 color conversion module

Project page: http://xyne.archlinux.ca/projects/python3-colorsysplus/
Over time I've written a lot of code to manage color conversions between different formats (hexadecimal, terminal, ANSI, CMYK, etc). Some of it has found its way into some of my projects (e.g. pychrom and tiv, both of which were written as afterthoughts from messing around with colors), but it's never really been directly accessible.
I finally got tired of cannibalizing my own code whenever I needed some conversion functions so I put everything in a single module and packaged it.
The source code is reasonably documented and relatively straight-forward, so it should be easy to use.
Anyone interested in this may also be interested in Lux Perpetua's script from which some of the code was adapted/cannibalized.
If you have any suggestions for additional functionality or ways that the existing code could be improved, let me know.
edit: screenshot
Last edited by Xyne (2012-10-22 07:50:07)

The package now contains a supplementary module for working with colorized text. It can convert to and from HTML, BBCode, ANSI, etc. and provides some functions for applying custom gradients and other fun stuff. This text was generated with the code. It could have just as easily been display in a compatible terminal.
Yes, I am aware that I appear to have too much time on my hands. In fact, the opposite is true. This is the result of procrastination and escapism.
But hey, look at the pretty colors! No, not the clock, the colors!

Similar Messages

  • Color Management Module In Photoshop

    Question:  A color management module is the software that defines the mathematical manipulations by which color conversions are made?

    Thanks for your quick reply.
    From: ronzie99 <[email protected]>
    To: IronEyesWally <[email protected]>
    Sent: Thursday, December 8, 2011 1:09 PM
    Subject: Color Management Module In Photoshop
    Re: Color Management Module In Photoshop created by ronzie99 in Photoshop Elements - View the full discussion
    There are different types of icc\icm profiles used in color management.
    First is the color workspace. PSE is by default set to create files in the color space embedded in the image opened and if not then the default color space of your choosing. The type of color space describes the gamut limitations of that color space.
    Next are device specific color profiles. These are the display and printer profiles but can also exist for input devices. These profiles serve as tables to fit the measured characteristicsof the device to the color space requireed. For output devices there are Rendering Intents that can be chosen to determine how the limitations of a device can be best interpolated to fit the color space of an image  into the limitations of the device for best appearance.
    A practical way to think of a display to output workflow think of the color space situated between the displayed image and the output device with the color space in the middle defining limitations as a standard. The devices profiles are then measured against the standard color profile to create corrections or translation table so they react appropropriately to present the image on the display for the output device target profile in an attempt to get a 'what you see is what you get' envirionment for the specific devices used.
    You need to create via calibration either by you (better) or insttall from the manufacturer a profile for the display. This matches your display device to the 'standard' profile. If you go to print then you'll need to install a printer profile (which varies by ink and paper type) either OEM or from paper suppliers or created by a measuring device you can purchase if you go 'rogue' regrding non-OEM inks and papers.
    PSE does not have a soft-proof mode built in like Photoshop. It does have a setup, though, where it will let you assign every time you print an output profile that you select if you want PSE to directly manage the printer for tonality and color, in which case in the printer driver itself you disable color management only leaving the driver to descrive the image quality and surface type of the paer chosen and choosing none or leaving icm unchecked in the printer driver. The profile is selected in the PSE printer driver under advanced.
    Soft proof mode is where the display translation is further manipulated to approximate the printer output. This can happen because you have calibrated your monitor to a standard and a printer tothat same standard. I have an add-on for PSE 10 called Elements +  that in addition to lots of filters and effects adds some soft-proofing capability and curve color level adjustments to PSE. http://www.simplephotoshop.com/elementsplus/index.htm
    In practical terms that is the function of color management.
    BTW: The defacto color space for the Internet web browsers is sRGB. Use this when correcting color for web distribution.
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4071890#4071890
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4071890#4071890. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Adobe Color Management Module 64bit support

    Hello,
    are there any plans to release a 64bit version of the Adobe Color Management Module?
    We are a licensee of the AdobeCMM and would like to release a 64bit version of our application.
    Thank you very much,
    best regards
    Ro_Gi

    if you want to give your 'vote' to having this in 64bit, go to this more in-depth thread
    http://feedback.photoshop.com/photoshop_family/topics/please_give_us_a_64_bit_version_of_a dobe_cmm
    the workaround is to do the color profile conversion within photoshop, and not within the canon plugin....

  • Content Conversion module in JMS Adapter - MessageTransformBean

    Hi All,
    We are using Content Conversion module using MessageTransformBean in JMS adapter to read a flat file from MQ Queue.It works fine and the file is getting picked and successfully converted into a xml structure in XI.
    The flat file is multiple line file with each line as one xml record.But the xml structure after conversion has only one record in it.So we end up getting multiple messages each with one record instead of ONE xml structure with multiple records in it.
    Could I know why I am not getting multiple records in one xml structure as expected.
    Do I need to change  xml.structureTitle as  MyTitle,* or should I put something endSeparator like we do in File Content Conversion.
    Any Help appreciated.
    Thanks,
    V
    Edited by: CollinsV on Aug 9, 2010 6:28 AM
    Edited by: CollinsV on Aug 9, 2010 6:36 AM
    Edited by: CollinsV on Aug 9, 2010 6:38 AM
    Edited by: CollinsV on Aug 9, 2010 6:39 AM
    Edited by: CollinsV on Aug 9, 2010 6:56 AM

    Thanks Shabarish .I did follow the same document , but the xml is not converted as multiple records in it .we are getting only one xml message for each record in the file .
    The xml structure we are getting :
    <ns:MyDocument xmlns:ns="http://xi.com/test">
    <MyTitle>
    <field-name1>111</field-name1>
    <field-name2>222</field-name2>
    <field-name3>333</field-name3>
    </MyTitle>
    </ns:MyDocument>
    We need onle one xml message instead as below.
    <ns:MyDocument xmlns:ns="http://xi.com/test">
    <MyTitle>
    <field-name1>AAA</field-name1>
    <field-name2>BBB</field-name2>
    <field-name3>CCC</field-name3>
    </MyTitle>
    <MyTitle>
    <field-name1>111</field-name1>
    <field-name2>222</field-name2>
    <field-name3>333</field-name3>
    </MyTitle>
    </ns:MyDocument>
    Any Help ...
    Thanks
    V

  • Complex XML to Plain in JMS adapter "Content conversion module"

    Hi!
    I have read the document on "How To… use the content conversion module with XI3.0 J2EE JMS Adapter", and it says only SimpleXML can be converted in the receiver channel.
    I had hoped for a solution at least as good as in the File/ftp adapter, where complex XML can be transformed to files.
    Are there plans to include complex XML conversion in the JMS adapter?
    I can not use the file adapter as I need to change the file name and destination, and that can not be done by adding own module to its single module.
    Any idea how I can achieve what I want?
    To only way I can find, is to create a file using the file/ftp adapter, and then pick it up again and treat all the lines as the same structure (one row = one xml field). Then output this new xml message to file, using the JMS adapter and add any modules with name and destination determination.
    Appreciate any help!
    Regards,
    Oeystein Emhjellen

    Hello,
    Have you tried to use an XSLT mapping within the IE?
    I have, at one customer site, created a XSLT message mapping which converts the  XML to a fixed length ASCII file format. I than added the XSLT message mapping as a second mapping step on the interface mapping.
    In this case I was able to publish a fairly complex fixed length file format to MQ Series via the JMS adapter.
    /Johan

  • Flat files to XML conversion module?

    Hi Experts,
    I would like to know from where I can have free download for flat files to XML conversion module which I can test in development server. Your help will be well appreciated.
    Thanks and Regards,
    Praveen.

    u have file adapter with FCC which does the flat file to XML conversion. wat is ur requirement?
    refer the help or search on SDN for file content conversion.
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    few examples:-
    Introduction to simple(File-XI-File)scenario and complete walk through for starters(Part1)
    Key value:
    How to send a flat file with various field lengths and variable substructures to XI 3.0
    File Receiver with Content Conversion
    chirag

  • [AS][IDCS3] PDF Export Preferences Color Conversion setting

    I want to set the field of Color Conversion (as equivalent to manual setting under Output>Color>Color Conversion) to "No Color Conversion" in Applescript but couldn't figure it out.
    My skeleton Applescript is as follow:-
    tell application "Adobe InDesign CS3"
       tell PDF export preferences
           -- I want to set No Color Conversion for Color Conversion here
       end tell
       tell document 1
           export format PDF type to filename without showing options
       end tell
    end tell
    I have search through Applescript ID CS3 dictionary but couldn't find the answer. Hope someone can advise. Thanks!

    Use:
    set effective PDF destination profile to use no profile
    Shane Stanley <[email protected]>
    AppleScript Pro Sessions <http://scriptingmatters.com/aspro>

  • [AS][INDCC] How to set Color Conversion field to No Color Conversion when creating PDF Export preset

    How can i set Color Conversion field in Export to PDF dialog to No Color Conversion when creating PDF Export preset? i have done a bit of searching and have found where it has been recommended to set effective pdf destination profile to use no profile but it doesn't seem to be producting the expected results.

    Yes, it seems that i had to make the change after creation, not while creating the preset. thank you.
    tell application "Adobe InDesign CC"
         set newPreset to make new PDF export preset with properties ¬
              {name:"preset name", standards compliance:none, acrobat compatibility:acrobat 7}
         tell newPreset to set PDF color space to unchanged color space
    end tell

  • I need this file "How to Use the Content Conversion Module in JMS Adapter"

    Can someone send me this file:
    "How to Use the Content Conversion Module in JMS Adapter"
    I am not able to find it.
    Thanks
    Antonello

    pls refer guide
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-adapters/how%20to%20use%20the%20content%20conversion%20module%20with%20xi%203.0%20j2ee%20jms%20adapter.pdf
    Regards,
    Swetha.

  • CMYK to RGB color conversion?

    Hi,
    I have to convert CMYK color array in the RGB color space and vice versa.
    I am  using the following code;-
    UID colorUID = iDrawing->GetColorUID(kFalse);
    UIDRef colourUIDRef(iDrawing->GetDataBase(), colorUID);
    InterfacePtr<IColorData> colorData(colourUIDRef, UseDefaultIID());
    char
    strColor[16]={0};
    if(colorData->GetColorSpace() == kPMCsCalRGB)
        ColorArray rgbColor = Utils<IUIColorUtils>()->GetRGBColorValue(m_DB, colorUID);
        sprintf(strColor,
    "#%.2x%.2x%.2x", ToInt32(rgbColor[0] * 255), ToInt32(rgbColor[1] * 255), ToInt32(rgbColor[2] * 255));
    else
        ErrorCode errStatus = GetRGBColorStr(colourUIDRef, strColor);
    ErrorCode GetRGBColorStr(UIDRef colourUIDRef,
    char* strColor){
        ErrorCode status = kFailure;
        do 
              I
    nterfacePtr<IColorData> colorData(colourUIDRef, UseDefaultIID());          IDataBase* m_DB = colourUIDRef.GetDataBase();
    // If color sapce is other then RGB then get the colour array
        ColorArray colourArray = colorData->GetColorData();
        // If the colour space is CMYK then convert it to RGB
        if(colorData->GetColorSpace() == ICMSProfile::kSourceTypeBuiltInCMYK)    {
              IDocument* document = Utils<ILayoutUIUtils>()->GetFrontDocument();
              ColorArray rgbColor = Utils<IColorSystemUtils>()->ColorTransform( document, colourArray, ICMSProfile::kSourceTypeBuiltInCMYK,ICMSProfile::kSourceTypeBuiltInRGB);
         sprintf(strColor,
    "#%.2x%.2x%.2x", ToInt32(Round(rgbColor[0] * 255)), ToInt32(Round (rgbColor[1] * 255)), ToInt32(Round(rgbColor[2] * 255)));     status = kSuccess;
    }while(kFalse);
    return status;
    }while(kFalse);
    return status;

    I did some experiments with Illustrator CS6 and the MacBeth RGB test chart and verified my results with Photoshop CS6. I discovered Illustrator is (mostly) doing what it should be doing, within a 1% error (probably rounding) on the output CMYK values. Here's a summary, in case anyone else needs this info:
    Assuming the source file's elements are all untagged, when a mixed RGB/CMYK PDF is opened in Illustrator and CMYK mode is
    chosen, Illustrator will use the profiles and rendering intent defined in
    Color Settings to make the color conversions from RGB to CMYK. Thus, we
    have control over the profiles used for this conversion.
    If the RGB elements in the PDF file have embedded ICC profiles,
    Illustrator will use the embedded ICC profile instead of the RGB profile
    defined in Color Settings. This ONLY happens, however, if the PDF file
    also includes the correct CMYK output intent profile.
    If the PDF doesn't contain a CMYK output intent, Illustrator will fall
    back on the Color Settings RGB profile for RGB->CMYK conversion. I believe it
    would be more correct for Illustrator to use the embedded RGB profile and
    the CMYK profile defined in Color Settings, but that's not how it seems to work.
    If the PDF contains the incorrect CMYK output intent, Illustrator will
    ignore the Color Settings and respect the embedded RGB and CMYK profiles
    for the conversion, as might be expected.

  • DNG & Camera Manf. JPG color conversions

    IF, a Camera Manf. had a camera that outputs to DNG ... could they imbed in the DNG file ... the "equivelent" of LR "pre-sets" for "there" JPG Color conversion.
    * So, In LR at a click of a Pre-set listing you could see what the Camera Manf. JPG out of the camera would be like. (if you "would have" shot this DNG in JPG) ... and then you could do a compair.
    Or maybe you would "just" run it as a choice on import ... as a starting point, or when in a rush a result.
    * Just curious ... could this be done?
    Is it only me, or could this be a useful productivity feature for LR.
    p.s. I do get the fact that you could make your own pre-sets for your camera.

    > "being a designer/distributor myself you are always trying to find ways to make your product (output) different and exclusive ... so yes, having a Generic DNG and making "my" product/output a commodity would not be my first choice either".
    I used to help design large, complicated, multi-supplier computer systems. I sometimes got involved with helping to procure products.
    The suppliers would try to make us enthusiastic about their special features. If we procured their products, we would often simply lose those features under an abstraction layer of software - they were unwanted! We needed interchangeable components. Call it "commodity" if you like - but I don't really agree with that term here. "Commodity" to me implies that it doesn't matter which you choose. "Interchangeable" still leaves other factors to be taken into account.
    If Nikon adopted DNG (chuckle!) we wouldn't really claim that a D40 and D80 and D200 and D2Xs were "commodity"! They would still be high quality high value differentiated products.
    In fact, camera manufacturers are pretty foolish if they adopt such an attitude. Within weeks of camera launch, all the major raw converter suppliers have reverse-engineered the raw files and camera details enough to be able to perform high quality raw conversions. All essential aspects of the specification are known, and sometimes even published by 3rd parties!
    Who do the camera manufacturers think they are hiding information from? Answer: "from 3rd party software companies whose mission is, in effect, to make the images from the camera look as good as possible"! How stupid can camera manufacturers be?
    DNG still has ways for camera manufacturers to hold what Adobe call "secret sauce". There may well be limitations in the current specification of DNG that causes problems for some manufacturers - Hasselblad-Imacon apparently had problems. But most manufacturers almost certainly have no such problems - and Pentax shows what CAN be done by a camera manufacturer, (the one who once tried to promote the idea of a universal lens mount), that cares about its users and sees the way the world is moving.

  • Printing RGB colors - Conversion to CMYK?

    Hi,
    I have been working for a little while in converting my old RGB colors to CMYK printer friendly colors.
    However, I carefully choosed my printing friendly CMYK colors to be as close as possible to the RGB colors but the prints are dull !
    On the other hand, when I print my file withj RGB colors using the PDF Distiller tagged with Adobe1998 profile and send the file to the printer, colors look smarter !
    It means that the CMYK colors I picked myself are not good enough anf the Color Managment in Adobe PDF or Illustrator are better than me ! As follows:
    - In Illustrator -> Print -> Color Management tab -> Color Handling: Let Illustrator determine colors
    - in Acrobat Reader -> Print -> Color Management tab of the plotter: Application managed colors
    Both ouput similar quality prints, and better than my own CMYK colors !
    Are the Application Color Management engines in Illustrator and in Adobe Reader similar in their conversion?
    How can I find out which are the CMYK colors printed when the application (Reader or Illustrator) manages colors, from my initial RGB colors? I would like to use them directly in my document...
    Thanks

    Hi,
    Thanks for your response. I put these color issues on hold because I had no time to search more on that recently...
    However, I have still lots of questions about color conversion!
    When I said "carefully choose" CMYK colors, it means CMYK colors printable and which look similar to my old RGB colors on-screen. But of course, screen is not enough!
    What I noticed is that when I print my old RGB colors (not in printer color space), Adobe Reader or Illustrator were able to make good conversion to CMYK for printing.
    Now, I would like to find out to which CMYK color codes Adobe Reader or Illustrator converted my RGB colors? Then, I would be able to use these CMYK color codes directly in my application...
    Is there any way to find out that?
    Cheers

  • Color conversion : special behavior with Spot Color "All"

    Hello,
    I have a document with printmarks which have a spot color "All". While I convert the page using the "Color conversion" to Gray 1.8 with Adobe Acrobat X the spot color "All" are still present (with the alternate color space DeviceGray).
    Using Adobe Acrobat 9.x all objects have a DeviceGray color.
    Is it a bug or a new behavior? Moreover the SDK method doesn't convert the spot color but keep the name (but I know this is not the right place to post it - it's just for information).
    Regards,
    Joe

    I sense you may not understand the difference between sopt and process colors in the printing process.
    When you use process inks you build all color representations by combining dots of varying sizes from each of the four process colors, cyan, magenta, yellow, and black. Because the dots are two small to be seen individually your brain is fooled into thinking it sees other colors. Process color printing requires four printing plates to produce the full range of colors possible, but that range is limited compared to what you can see in real life or capture in RGB.
    Spot colors, in contrast, are similar to paint. Each color is mixed individually, and every spot color requires its own plate on the printing press (and you must use a press -- toner and inkjet printers use cmyk inksets and cannot print real spot colors). Because of the expense of these plates, the use of spot colors is usually limited to one or two colors in any print job, and if the job has other color (like photographs) that requires process inks, converting the spot colors to the closest process simulation is often employed if the spot colors can be simulated "close enough" to satisfy the client and the budget is tight.
    I would avoid using process colors for type in small sizes or for very thin strokes, especially in lighter colors, as you are likely to see ragged edges.
    So, how many spot color swatches did you use? More than two? More than four? Do you have a huge budget to produce the work? This may be a project that really should be designed from the ground up as process, or process and one spot for that hard to print bright accent color.

  • Disable color conversion when PDF export

    how to disable color conversion in my sample scritp?
    pdfExportPreset = app.pdfExportPresets.add({
                    name:"sample preset",
    pdfExportPreset.standardsCompliance = PDFXStandards.PDFX1A2001_STANDARD;

    actualy, if you need PDF-X1A standard, it's not as much about the export preset as is about the workflow. PDF/X-1a requires all fonts need to be embedded and all images need to be CMYK or spot colors. So if you have RGB images, they will be converted to obey the standard.

  • Crash while launching in "building color conversion tables"

    Photoshop CS6 crashes while "building color conversion tables"  I reinstalled the program but it still hangs up at this point.  please help!

    I've only seen 3 things that can cause a crash at that point: corrupt profiles (mostly display profiles), corrupt information coming from the OS about the system profiles, and bad floating point units in CPUs.
    First thing to check is the display profiles. If setting them to sRGB doesn't solve the crash, it might be a bug in the OS profile cache.  And let's hope it isn't the CPU, because those problems are a @$%^@#%# to track down in modern processors.

Maybe you are looking for