Idea Digital Imaging Ltd

Scanning, retouching, page layout, proofing

  • Increase font size
  • Default font size
  • Decrease font size
Home Obessions AppleScript Idea16777216

Idea16777216

Here's an AppleScript that will make Adobe Photoshop create a colour chart with 16,777,216 colours.

Idea 16,77,216 colour chart

You can use the chart to evaluate profiles and see just how much clipping occurs when you do RGB to RGB conversions in Photoshop.

 

 

-- Idea16777216 by Martin Orpen
-- Script will generate a target of 16,777,216 pixels
-- and 16,777,216 colours. No pixels wasted :)

tell application "Adobe Photoshop CS4"
    --this script uses copy and paste so PS must be frontmost during execution
    activate
    
    --16 bit mode is set below because in 8 bit PS will not set the colour values correctly
    set docRef to make new document with properties {mode:RGB, bits per channel:sixteen, width:4096 as pixels, height:4096 as pixels, name:"Idea16777216"}
    tell current document
        set {x, y, z} to {0, 0, 4096}
        set {r, g, b} to {255, 255, 255}
        set current channels to channel 1
        repeat 256 times
            select region {{x, y}, {x, y + z}, {x + 1, y + z}, {x + 1, y}} feather amount 0
            fill selection with contents {class:RGB color, red:r, green:g, blue:b}
            set x to x + 1
            set r to r - 1
            set g to g - 1
            set b to b - 1
        end repeat
        set x to 0
        set current channels to channel 1
        select region {{x, y}, {x, y + z}, {x + 256, y + z}, {x + 256, y}} feather amount 0
        copy
        repeat 15 times
            set x to x + 256
            select region {{x, y}, {x, y + z}, {x + 256, y + z}, {x + 256, y}} feather amount 0
            paste
        end repeat
        set {x, y, z} to {0, 0, 4096}
        set {r, g, b} to {255, 255, 255}
        set current channels to channel 2
        repeat 256 times
            select region {{x, y}, {x, y + 1}, {x + z, y + 1}, {x + z, y}} feather amount 0
            fill selection with contents {class:RGB color, red:r, green:g, blue:b}
            set y to y + 1
            set r to r - 1
            set g to g - 1
            set b to b - 1
        end repeat
        set y to 0
        set current channels to channel 2
        select region {{x, y}, {x, y + 256}, {x + z, y + 256}, {x + z, y}} feather amount 0
        copy
        repeat 15 times
            set y to y + 256
            select region {{x, y}, {x, y + 256}, {x + z, y + 256}, {x + z, y}} feather amount 0
            paste
        end repeat
        set {x, y, z} to {0, 0, 256}
        set {r, g, b} to {255, 255, 255}
        set current channels to channel 3
        repeat 16 times
            repeat 16 times
                select region {{x, y}, {x, y + z}, {x + 256, y + z}, {x + 256, y}} feather amount 0
                fill selection with contents {class:RGB color, red:r, green:g, blue:b}
                set x to x + 256
                set r to r - 1
                set g to g - 1
                set b to b - 1
            end repeat
            set x to 0
            set y to y + 256
        end repeat
        deselect
        set current channels to component channels
        
        --optional remove if you want 16 bit images
        set bits per channel to eight
    end tell
end tell

Last Updated on Wednesday, 03 February 2010 11:50  


Newsflash

New Web Site -- we've upgraded to Joomla 1.5.