Manipulating imagedata - quickest technique?

David Burgun dburgun at dsl.pipex.com
Mon Apr 3 06:18:44 EDT 2006


Hi,

I wrote an External Command to do image processing work. It is *way*  
faster than doing it in TranScript. It also implemented an image cache.

If you want to write an External Command, I can give you some pointers.

All the Best
Dave

On 3 Apr 2006, at 11:03, David Bovill wrote:

> What's the quickest technique? This script is based on some of  
> Chipps work... baiscally it loops through the whole imageData 4  
> chars at a time and manipulates each chunk before adding it to the  
> new data.
>
> A few questions:
>
>    1) Is this the fastest way?
>
>    2) Can someone explain the use of binaryEncode - is this faster  
> or slower?
>
>    3) Is there a way to cash some intermediary form of data that is  
> faster to manipulate?
>
> For the last point - imagine having sliders for HSV values. At the  
> moment the script converts rgb in the imageData to hsv and back  
> again - by caching the original images HSV data this could speed  
> things up nearly 200%? So what sort of format would make the most  
> sense to store this data in - some sort of table / array?
>
>> on colour_SetBrightness imageObject, somePercent
>>     set the cursor to watch
>>         put the imageData of imageObject into someImageData
>>     put 0 into tPos
>>     put the length of someImageData / 4 into binaryPixelNum
>>          repeat for binaryPixelNum times
>>         put tPos + 4 into tPos
>>                 put charToNum(char tPos + 1 of someImageData) into r
>>         put charToNum(char tPos + 2 of someImageData) into g
>>         put charToNum(char tPos + 3 of someImageData) into b
>>                 colour_LightenRGB somePercent, r, g, b
>>                 put binaryEncode("CCCC", 0, r, g, b) after  
>> newImageData
>>     end repeat
>>     -- put newImageData
>>     set the imageData of imageObject to newImageData
>> end colour_SetBrightness
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list