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.
Similar Messages
-
Use apple script to get the duration of soundfiles and send the info to FileMaker
I have close to 6000 soundfiles in approx. 20 subfolders of a folder called soundarchive and a FileMaker DB of all those files. Here's what I'd like to do. Get the duration of each file and send it to the "duration" field of the matching FMrecord. I don't know a lot about AppleScript (or programming anything apart from my HD recorder), what I do know is that a script will save me from a week of copy-pasting the info manually. I found a script by hubionmac that does the first part (for one file) it goes like this:
set aFile to choose file
tell application "Finder" to set filename to name of aFile
set AppleScript's text item delimiters to " = "
set duration to text item 2 of (do shell script "mdls -name kMDItemDurationSeconds " & quoted form of (POSIX path of aFile))
set AppleScript's text item delimiters to "."
set total_seconds to text item 1 of duration
set AppleScript's text item delimiters to ""
set showsec to (total_seconds as integer) mod 60
set showmin to (total_seconds as integer) div 60
display dialog filename & return & return & "Duration:" & return & showmin & " min " & showsec & " sec"
So this is for one file. How do I get the information for the other 5000+ files and send it to the FileMaker DB. Obviously the "display dialog" won't do so it'll have to be changed to something like "get". How do I proceed from here?Hi Preetha7,
I found one automated SQL Server Health Check Solution which may meet your needs. The daily health checks include checking CPU utilization, database status, available disk space, network packet errors, database backup status, and more. For more detail about
this solution, please refer to the following article:
http://sqlmag.com/database-administration/automated-sql-server-health-check-solution
In addition, if you want to write your own script to perform a quick health check of SQL Server using PowerShell, please refer to the following article:
http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/25/use-powershell-to-monitor-your-sql-server-performance.aspx
If you have any question, please feel free to let me know.
Regards,
Jerry Li -
Powershell script to get the low disk space on the servers...
Hi,
We have many SQL & Sharepoint servers running on windows server. I need some Powershell script to get the low disk space on those servers and it should send an mail alert saying "Disc d:\ have less than threshold 15% free space".
Awaiting for response.
Thanks
Anilyou should be able to use this powershell script which you can run as a scheduled task.
just change the details at the start of the script to point the script to the right location to create log files. you will need to have a plain text file containing a list of server names or ip addresses that you want to check drive space on.
# Change the following variables based on your environment
#specify the path to the file you want to generate containing drive space information
$html_file_dir = "\\server\share\DriveSpace"
#specify the path and file name of the text file containing the list of servers names you want to check drive space on - each server name on a seperate line in plain text file
$server_file = "\\server\share\servers.txt"
#speicfy the from address for the email
$from_address = "[email protected]"
#specify the to address for the email
$to_address = "[email protected]"
#specify the smtp server to use to send the email
$email_gateway = "smtp.domain.com" # Can either be DNS name or IP address to SMTP server
# The seventh line from the bottom (line 167) is used if your smtp gateway requires authentication. If you require smtp authentication
# you must uncomment it and set the following variables.
$smtp_user = ""
$smtp_pass = ""
# Change the following variables for the style of the report.
$background_color = "rgb(140,166,193)" # can be in rgb format (rgb(0,0,0)) or hex format (#FFFFFF)
$server_name_font = "Arial"
$server_name_font_size = "20px"
$server_name_bg_color = "rgb(77,108,145)" # can be in rgb format (rgb(0,0,0)) or hex format (#FFFFFF)
$heading_font = "Arial"
$heading_font_size = "14px"
$heading_name_bg_color = "rgb(95,130,169)" # can be in rgb format (rgb(0,0,0)) or hex format (#FFFFFF)
$data_font = "Arial"
$data_font_size = "11px"
# Colors for space
$very_low_space = "rgb(255,0,0)" # very low space equals anything in the MB
$low_space = "rgb(251,251,0)" # low space is less then or equal to 10 GB
$medium_space = "rgb(249,124,0)" # medium space is less then or equal to 100 GB
#### NO CHANGES SHOULD BE MADE BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
# Define some variables
$ErrorActionPreference = "SilentlyContinue"
$date = Get-Date -UFormat "%Y%m%d"
$html_file = New-Item -ItemType File -Path "$html_file_dir\DiskSpace_$date.html" -Force
# Create the file
$html_file
# Function to be used to convert bytes to MB or GB or TB
Function ConvertBytes {
param($size)
If ($size -lt 1MB) {
$drive_size = $size / 1KB
$drive_size = [Math]::Round($drive_size, 2)
[string]$drive_size + ' KB'
}elseif ($size -lt 1GB){
$drive_size = $size / 1MB
$drive_size = [Math]::Round($drive_size, 2)
[string]$drive_size + ' MB'
}ElseIf ($size -lt 1TB){
$drive_size = $size / 1GB
$drive_size = [Math]::Round($drive_size, 2)
[string]$drive_size + ' GB'
}Else{
$drive_size = $size / 1TB
$drive_size = [Math]::Round($drive_size, 2)
[string]$drive_size + ' TB'
# Create the header and footer contents of the html page for output
$html_header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Server Drive Space</title>
<style type="text/css">
.serverName { text-align:center; font-family:"' + $server_name_font + '"; font-size:' + $server_name_font_size + `
'; font-weight:bold; background-color: ' + $server_name_bg_color + '; border: 1px solid black; width: 150px; }
.headings { text-align:center; font-family:"' + $heading_font + '"; font-size:' + $heading_font_size + `
'; font-weight:bold; background-color: ' + $heading_name_bg_color + '; border: 1px solid black; width: 150px; }
.data { font-family:"' + $data_font + '"; font-size:' + $data_font_size + '; border: 1px solid black; width: 150px; }
#dataTable { border: 1px solid black; border-collapse:collapse; }
body { background-color: ' + $background_color + '; }
#legend { border: 1px solid black; ; right:500px; top:10px; }
</style>
<script language="JavaScript" type="text/javascript">
<!--
function zxcWWHS(){
if (document.all){
zxcCur=''hand'';
zxcWH=document.documentElement.clientHeight;
zxcWW=document.documentElement.clientWidth;
zxcWS=document.documentElement.scrollTop;
if (zxcWH==0){
zxcWS=document.body.scrollTop;
zxcWH=document.body.clientHeight;
zxcWW=document.body.clientWidth;
else if (document.getElementById){
zxcCur=''pointer'';
zxcWH=window.innerHeight-15;
zxcWW=window.innerWidth-15;
zxcWS=window.pageYOffset;
zxcWC=Math.round(zxcWW/2);
return [zxcWW,zxcWH,zxcWS];
window.onscroll=function(){
var img=document.getElementById(''legend'');
if (!document.all){ img.style.position=''fixed''; window.onscroll=null; return; }
if (!img.pos){ img.pos=img.offsetTop; }
img.style.top=(zxcWWHS()[2]+img.pos)+''px'';
//-->
</script>
</head>
<body>'
$html_footer = '</body>
</html>'
# Start to create the reports file
Add-Content $html_file $html_header
# Retrieve the contents of the server.txt file, this file should contain either the
# ip address or the host name of the machine on a single line. Loop through the file
# and get the drive information.
Get-Content $server_file |`
ForEach-Object {
# Get the hostname of the machine
$hostname = Get-WmiObject -Impersonation Impersonate -ComputerName $_ -Query "SELECT Name From Win32_ComputerSystem"
$name = $hostname.Name.ToUpper()
Add-Content $html_file ('<Table id="dataTable"><tr><td colspan="3" class="serverName">' + $name + '</td></tr>
<tr><td class="headings">Drive Letter</td><td class="headings">Total Size</td><td class="headings">Free Space</td></tr>')
# Get the drives of the server
$drives = Get-WmiObject Win32_LogicalDisk -Filter "drivetype=3" -ComputerName $_ -Impersonation Impersonate
# Now that I have all the drives, loop through and add to report
ForEach ($drive in $drives) {
$space_color = ""
$free_space = $drive.FreeSpace
$total_space = $drive.Size
$percentage_free = $free_space / $total_space
$percentage_free = $percentage_free * 100
If ($percentage_free -le 5) {
$space_color = $very_low_space
}elseif ($percentage_free -le 10) {
$space_color = $low_space
}elseif ($percentage_free -le 15) {
$space_color = $medium_space
Add-Content $html_file ('<tr><td class="data">' + $drive.deviceid + '</td><td class="data">' + (ConvertBytes $drive.size) + `
'</td><td class="data" bgcolor="' + $space_color + '">' + (ConvertBytes $drive.FreeSpace) + '</td></tr>')
# Close the table
Add-Content $html_file ('</table></br><div id="legend">
<Table><tr><td style="font-size:12px">Less then or equal to 5 % free space</td><td bgcolor="' + $very_low_space + '" width="10px"></td></tr>
<tr><td style="font-size:12px">Less then or equal to 10 % free space</td><td bgcolor="' + $low_space + '" width="10px"></td></tr>
<tr><td style="font-size:12px">Less then or equal to 15 % free space</td><td bgcolor="' + $medium_space + '" width="10px"></td></tr>
</table></div>')
# End the reports file
Add-Content $html_file $html_footer
# Email the file
$mail = New-Object System.Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($html_file)
$mail.From = $from_address
$mail.To.Add($to_address)
$mail.Subject = "Server Diskspace $date"
$mail.Body = "The diskspace report file is attached."
$mail.Attachments.Add($att)
$smtp = New-Object System.Net.Mail.SmtpClient($email_gateway)
#$smtp.Credentials = New-Object System.Net.NetworkCredential($smtp_user,$smtp_pass)
$smtp.Send($mail)
$att.Dispose()
# Delete the file
Remove-Item $html_file
Regards,
Denis Cooper
MCITP EA - MCT
Help keep the forums tidy, if this has helped please mark it as an answer
My Blog
LinkedIn: -
How can I get the erasure tool to leave a white or color background and not checkered?
When using the erasure or erasure background tools, it leaves a checkered background. How can I get the erasure tool to leave a white or color backround?
Jpegs can't have transparent areas. Most likely you had layers and were forced to save "as a copy", which means that the image which remains open in PSE is not the jpg. A file saved as a copy makes a copy in the save format, but it's not like save as where you now see the newly saved version instead of the original. The original remains open and unsaved onscreen.
-
Is there inbuild Handler in weblogic using which i can get the MessageContext object
HI,
I need MessageContext object in my application but i dont want to use the Handler,As
there is AxisEngine in axis soap engine,is there any similar implementation in
weblogic.
AxisEngine.getCurrentMessageContext() we can get the MessageContext what about
in weblogic..any body any idea???
Regards,
Akhil NagpalHI,
yeah i had to make use of Handler to get the MessageContext object and play with
that.
Thanks & Regards
Akhil Nagpal
"manoj cheenath" <[email protected]> wrote:
You can get to MessageContext from a handler. Check out an example of
handler
to see how you can get Message out of MessageContext.
-manoj
"Akhil Nagpal" <[email protected]> wrote in message
news:[email protected]..
HI manoj,
Thanks for your reply.otherwise i thought that i wont get any morehelp
on this
forum :-) ...
anyway its good that we will have such thing in next version,duringthe
development
i feel that more functioanlity should be in build in appserver. Likeone
more
thing i could not find out is how we can get the "message" object inweblogic
like we can in axis using its MessageContext class's static method.if it
is there
can you please let me knwo about that.
The other problem i had to make use of handler and my appl is workingas of
now :-)
Regards
Akhil Nagpal
"manoj cheenath" <[email protected]> wrote:
You can not do this in WLS 7.0. The next major release (WLS 8.1) will
fix
this problem.
-manoj
"Akhil Nagpal" <[email protected]> wrote in message
news:[email protected]..
HI,
I need MessageContext object in my application but i dont want
to
use
the Handler,As
there is AxisEngine in axis soap engine,is there any similarimplementation in
weblogic.
AxisEngine.getCurrentMessageContext() we can get the MessageContextwhat
about
in weblogic..any body any idea???
Regards,
Akhil Nagpal -
I have a 60 inch Sony XBR TV that has DVI input but not HDMI. I am using an adapter to get the video from my Apple TV to the Sony, but the screen flashes a lot. Do I have any other choices other than buying a new TV?
Is this an iphone question?
You have posted in the iphone forum. -
Use SQL function to get the original order number using the invoice number
Hi All,
wondering is someone can help me with this challenge I am having? Often I need to return the original order numbers that created the resulting invoce. This is a relatively simple seriese of joins in a query but I am wanting to simplify it using a SQL function that can be referenced each time easily from with in the SELECT statement. the code i currently have is:
Use SQL function to get the original order number using the invoice number
CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
RETURNS nvarchar(200)
AS
BEGIN
DECLARE @OrderList nvarchar(200)
SET @OrderList = ''
SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
FROM OINV AS T1 INNER JOIN
INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
ORDR AS T6 ON T5.DocEntry = T6.DocEntry
WHERE T1.DocNum = @InvNum
RETURN @OrderList
END
it is run by the following query:
Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
From OINV T1
Where T1.DocNum = 'your invoice number here'
The issue is that this returns the order number for all of the lines in the invoice. Only want to see the summary of the order numbers. ie if 3 orders were used to make a 20 line inovice I only want to see the 3 order numbers retuned in the field.
If this was a simple reporting SELECT query I would use SELECT DISTINCT. But I can't do that.
Any ideas?
Thanks,
MikeThanks Gordon,
I am trying to get away from the massive table access list everytime I write a query where I need to access the original order number of the invoice. However, I have managed to solve my own problem with a GROUP BY statement!
Others may be interested so, the code is this:
CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
RETURNS nvarchar(200)
AS
BEGIN
DECLARE @OrderList nvarchar(200)
SET @OrderList = ''
SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
FROM OINV AS T1 INNER JOIN
INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
ORDR AS T6 ON T5.DocEntry = T6.DocEntry
WHERE T1.DocNum = @InvNum
GROUP BY T6.DocNum
RETURN @OrderList
END
and to call it use this:
Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
From OINV T1
Where T1.DocNum = 'your invoice number' -
Hi Experts,
I am trying to build a PowerShell Script to get the details Like Scope,Last Deployed date and Name for a Solution Deployed in the Farm.
Can anyone advise on this please.
RegardsGet-SPSolution|Select Name,Scope,LastOperationResult,LastOperationEndTime|Export-CSV "SPInstalledSolutions.csv" -NoTypeInformation
SPSolution properties
Get-SPSolution
This post is my own opinion and does not necessarily reflect the opinion or view of Slalom. -
Need VB script for getting the IIS certification information
Hi guys,
I have totally 1000 IIS servers 2003 & 2008
windows and some of the servers configured
IIS 3rd party Security certificates. I need a script to get the certification information like expiry date & certificate vendor name.
Regards,
SreeMPost here:http://forums.iis.net/
Look in Gallery for IIS scripts:http://gallery.technet.microsoft.com/
¯\_(ツ)_/¯ -
Can I download and use celtx script software on the Blackberry Playbook?
Can I download and use celtx script software on the Blackberry Playbook? I really love the program and was looking at buying a playbook but would only do it if I could download that software.
cups pdf is like cute pdf but for mac
https://bitbucket.org/codepoet/cups-pdf-for-mac-os-x/downloads
after installing you need to go to settings, printer, add printer
full instructions here
http://basics4mac.com/article.php/print_to_pdf
pdfs go in /Users/Shared/CPS-PDF/{your account name}
This creates a virtual printer just like cute pdf does. This allows pdfs from applications that do not use the mac print interface -
My IPad mini hangs on the Internet. Will not start. Have rebooted the home and on / off. There is internet in the house (using it now). Getting the message: Safari can not open the page ...... What do I do?
Try this:
1. Close all inactive apps in the Task Bar. Double-click the Home button and hold apps down for a second or two. Tap the minus sign to close app.
2. Hold the Sleep and Home button down for about 10 seconds until you see the Apple Logo. -
I am trying to upgrade to itunes 10.7 using windows and keep getting the following error message: "Error writing to file: C:\Config.Msi\364460.rbf Verify access to this dierctory". Help!
Fixed! (win7 64 bit)! Just stop your antivirus during the upgrade/installation (I've got Kaspersky).
Good luck! -
If I try to rotate a photo in the Finder menu I get the never ending spinning color wheel?
If I try to rotate a photo in the Finder menu I get the never ending spinning color wheel?
The problem with write permissions for the OneDrive folder only shows up in Lightroom 6's export dialogue, that's why it's to irritating. Lightroom 5.7.1 is not having that problem nor does the file explorer. The problem also exists on both of my machines. I will try to check for other problems with the OneDrive troubleshooter though: Running the OneDrive troubleshooter - Windows Help
-
I want to use my wifi iPad for navigation but now realise it doesn't have gps built in. Is it possible to use hot spot to get the gps location to my iPad from my iphone? Long shot I know!
I thought yes, more like this on the right says no. Why not take the two devices outside and try.
-
When a pop up window comes up it is - search bookmarks and history window! I cannot log into my bank as login button should open new window to log in but I get the search page. I cannot see larger images as again I get the search bookmarks and history page etc. Happens on all options that should open new page. I am so frustrated, this has been happening since Firefox updated itself 2 days ago to Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET4.0C) was fine before that. using windows vista. Can you please advise what I should do? Also can you go back to previous version? Error console eg
Warning: Error in parsing value for 'cursor'. Declaration dropped.
Source File: https://ib.nab.com.au/nabib/styles/menu_nab.css?id=009
Line: 116
ib.nab.com.au : server does not support RFC 5746, see CVE-2009-3555 and Warning: Selector expected. Ruleset ignored due to bad selector.
Source File: https://ib.nab.com.au/nabib/styles/nabstyle.css?id=014
Line: 837
== This happened ==
Every time Firefox opened
== 2 days ago after update.Do you have that problem when running in the Firefox SafeMode?
[http://support.mozilla.com/en-US/kb/Safe+Mode]
''Don't select anything right now, just use "Continue in SafeMode."''
If not, see this:
[http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]
Maybe you are looking for
-
XSLT mapping with Java helper classes
Hi, I'm trying to implement a XSLT mapping to convert my request to a specific soap request message format for this I'm calling some methods from a java helper class. I have imported the jar file into the archives. When I tried to test the interface
-
Printing to a Specific Output Bin
I have been asked to setup an output queue in SAP where all output to that printer goes to a specfic (non-default) output bin on the printer. The printer is a HP 8050 multi-function printer with 5 different output bins. I have determined the PJL and
-
Hello, I am trying to update my BOMs via DTW. There is a tick box called "Hide BOM Components on Printoutu201D on the SALES BOM that i would like to tick but it doesnt seem to have a mapping in the DTW template. I've tried adding a column called "Hid
-
ITunes 10.2.2 requires Safari 4.0.3 or later to be installed
I am running Mac osx 10.6.7 and I have updated Itunes to 10.2.2 and I am getting the "iTunes requires Safari 4.0.3 or later to be installed to use the iTunes Store within iTunes. Use Software Update to download and install the latest version of Safar
-
Customer and Order import via CSV (webshop to Business One Import)
I have an Oscommerce website that is currently processing around 200 orders aday. Its a ballache to say the least to create 200 customers and then create 200 orders. The website can export the orders in a csv file (Im sure all be it with the wrong fi