• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: extracting embedded profiles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extracting embedded profiles


  • Subject: Re: extracting embedded profiles
  • From: John Linthicum <email@hidden>
  • Date: Tue, 14 Mar 2006 11:39:26 -0500
  • Thread-topic: extracting embedded profiles

On 3/14/06 5:12 AM, "Marttila Jouni" <email@hidden> wrote:

> Thanks Alexey - we have XF - I will try it

There's a Applescript that's in /Library/Scripts/Colorsync/ called "Extract
Profile" that I've used to do this also.

Should you not have this, here it is:

(*
Extract profile
©2002 Apple Computer, Inc.

Based on Show Profile Info, this script will extract the embedded profile
from an image and save it to disk.
*)


on run
    display dialog "Extract the profile from an image and save to disk."
    set somefile to choose file with prompt "Choose an image"
    open somefile
end run


on open draggeditems
    tell application "ColorSyncScripting" to launch

    display dialog "Extract profiles from images and save to disk?"

    set sourcefiles to filelistFromSelection(draggeditems)
    repeat with thisFile in sourcefiles
        try
            tell application "Finder" to reveal item thisFile
            set thisFile to thisFile as alias

            tell application "ColorSyncScripting" to set openImage to open
thisFile
            try
                openImage
                set itsAnImage to true
            on error
                set itsAnImage to false
                activate
                display dialog theFileName & " is not a supported image
type"
            end try

            if itsAnImage then
                tell application "ColorSyncScripting" to set profCount to
count of every profile of openImage
                if profCount is 0 then
                    activate
                    display dialog "no profile in " & theFileName buttons
{"OK"} default button 1
                else
                    tell application "ColorSyncScripting" to set theProfile
to profile 1 of openImage

                    -- this is the important part
                    tell application "ColorSyncScripting" to set
internalName to name of theProfile
                    set strCount to count characters of internalName
                    if strCount > 251 then
                        set newProfileName to ((characters 1 through 251 of
internalName) & ".icc") as string
                    else
                        set newProfileName to (internalName & ".icc") as
string
                    end if

                    activate
                    set tempFile to choose file name default name
newProfileName with prompt "Save profile as..."
                    tell application "Finder"
                        try
                            move item (tempFile as alias) to trash
                        end try
                    end tell
                    tell application "ColorSyncScripting" to save theProfile
in tempFile with replacing
                end if
                tell application "ColorSyncScripting" to close openImage
            end if

        on error errmsg number errnum
            --bring up a dialog to inform the user
            activate
            display dialog errmsg buttons {"OK"} default button 1
            --but we won't return an error, this way we'll just blow off any
errors we encounter
            --with multiple files, and keep processing the rest of the files
in the selection
        end try
    end repeat

    tell application "ColorSyncScripting" to set quit delay to 5
end open


--returns dragged files OR files at first level of one dragged folder
on filelistFromSelection(theselection)
    set hasfolder to false
    tell application "Finder"
        repeat with thisItem in (theselection as list)
            if (class of item thisItem is folder) or (class of item thisItem
is disk) then
                set hasfolder to true
            end if
        end repeat
    end tell
    if ((count item of (theselection as list)) > 1) and hasfolder then
        display dialog "Drag multiple files or a single folder." buttons
{"OK"} default button 1
        return ""
    end if
    tell application "Finder"
        if hasfolder then
            set filelist to (every item of folder (item 1 of (theselection
as list))) as alias list
        else
            set filelist to (theselection as list)
        end if
    end tell
    return filelist
end filelistFromSelection

--
Regards,
John


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >RE: extracting embedded profiles (From: Marttila Jouni <email@hidden>)

  • Prev by Date: Not familiar with PowerRIP X & PowerRIP X LF v7.0
  • Next by Date: Re: TR001 and GRACol
  • Previous by thread: RE: extracting embedded profiles
  • Next by thread: Re: extracting embedded profiles
  • Index(es):
    • Date
    • Thread