CFLib.org – Common Function Library Project

isImageCMYK(image)

Last updated July 8, 2013

author

James Moberg

Version: 1 | Requires: CF10 | Library: UtilityLib

Description:
Pass a file path or image object and it will identify whether the image uses a CUSTOM (CMYK) color palette.

Return Values:
Returns a boolean

Example:

<cfset ImageFile = expandPath("logo.jpg")>
<cfset ImageObject = ImageRead(ImageFile)>
<cfoutput>
fileOb = isImageCMYK(ImageFile)<br>
ob = isImageCMYK(ImageObject)<br>
</cfoutput>

Parameters:

Name Description Required
image Either a path to an image or an image object. Yes

Full UDF Source:

<!---
 Identifies CMYK images.
 
 @param image 	 Either a path to an image or an image object. (Required)
 @return Returns a boolean 
 @author James Moberg (james@ssmedia.com) 
 @version 1, July 8, 2013 
--->
<cffunction name="isImageCMYK" returntype="boolean" output="false" hint="Returns a true/false indicator regarding if image uses CMYK (CUSTOM) palette.">
	<cfargument name="image" default="" required="true" hint="path w/file or image object" />
	<cfset local.testImage = "">
	<cfset local.isCMYK = 0>
	<cfif IsSimpleValue(arguments.image)>
		<cfif fileExists(arguments.image) and isImageFile(arguments.image)>
			<CFSET local.testImage = imageRead(arguments.image) />
		</cfif>
	<cfelseif isImage(arguments.image)>
		<cfset local.testImage = arguments.image />
	</cfif>
	<cfif isImage(local.testImage)>
		<cfif not val(imageGetBufferedImage(local.testImage).getType())>
			<cfset local.isCMYK = 1 />
		</cfif>
	</cfif>
	<cfreturn local.isCMYK />	
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson