Eyeon:Script/Reference/Applications/Fuse/Classes/Image/CSConvert

From VFXPedia

< Eyeon:Script | Reference | Applications | Fuse | Classes | Image
Revision as of 15:12, 27 November 2007 by Izyk (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


Summary

The CSConvert method will convert the image to the specified color space.


Usage

Image:CSConvert(string from, string to)

from (string, required)
A string specifying the colorspace the image is currently in. Can be one of the following values. "RGB", "HLS", "YUV", "YIQ", "CMY", "HSV", "XYZ", "LAB".
to (string, required)
A string specifying the colorspace to convert the image into. Can be one of the following values. "RGB", "HLS", "YUV", "YIQ", "CMY", "HSV", "XYZ", "LAB".

Example

A simple Fuse to convert an Image from RGB to HLS and back again.

FuRegisterClass("HLSConvert", CT_Tool, {
	REGS_Category = "Fuses\\Samples",
	REGS_OpIconString = "HLS",
	REGS_OpDescription = "CSConvert Example Fuse",
	REG_NoMotionBlurCtrls = true,
	})
	
function Create()
	InOperation = self:AddInput("Convert", "Convert", {
		LINKID_DataType = "Number",
		INPID_InputControl = "MultiButtonControl",
		INP_Default = 0.0,
		{ MBTNC_AddButton = "RGB To HLS", MBTNCD_ButtonWidth = 0.5, },
		{ MBTNC_AddButton = "HLS to RGB", MBTNCD_ButtonWidth = 0.5, },
	})
	
	InImage = self:AddInput("Input", "Input", {
		LINKID_DataType = "Image",
		LINK_Main = 1,
		})
 
	OutImage = self:AddOutput("Output", "Output", {
		LINKID_DataType = "Image",
		LINK_Main = 1,
		})	
end
 
function Process(req)
	local op = InOperation:GetValue(req).Value
	local img = InImage:GetValue(req)
	
	local newimg = img:Copy()
	
	if op == 0 then
		newimg:CSConvert("RGB", "HLS")
	else
		newimg:CSConvert("HLS", "RGB")
	end
	
	OutImage:Set(req, newimg)
end


Tips for CSConvert (edit)

EyeonTips:Script/Reference/Applications/Fuse/Classes/Image/CSConvert