Q: Can I use only a part of an Image File and do stuff with it ?

Phil Davis revdev at pdslabs.net
Thu Oct 1 17:57:12 EDT 2009


Nice, Jim! I see I misunderstood the goal in my post. Oh well.

Phil Davis


Jim Lambert wrote:
> And here's the code:
>
> http://netrin.on-rev.com/animateimage/animateimage.html
>
> Jim Lambert
>
>
> On Sep 30, 2009, at 11:29 AM, Jim Lambert wrote:
>
>>>
>>> Date: Wed, 30 Sep 2009 18:13:05 +0300
>>> From: Richmond Mathewson <richmondmathewson at gmail.com>
>>> Subject: Re: Q: Can I use only a part of an Image File and do stuff
>>>     with it ?
>>> To: How to use Revolution <use-revolution at lists.runrev.com>
>>> Message-ID: <4AC37581.1020105 at gmail.com>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>>
>>> Rolf Kocherhans wrote:
>>>> For instance I have an imported Image file (png) 10 pixels high and
>>>> 100 pixels long.
>>>>
>>>> From pixel 1 to 10 ist Picture_one, from pixel 11 to 20 is Picture
>>>> _two etc.
>>>>
>>>> Can I the display those 2 respectively 10 pictures individually ?
>>>>
>>>> Cheers
>>>> Rolf
>>>>
>>> If you look up 'pixel' in the Documentation you will find that this
>>> cannot be done.
>>>
>>> However, you could chop up your image by importing snapshots of 
>>> parts of it:
>>>
>>> on mouseUp
>>>   import snapshot from rectangle 0,0,300,454 of img "iXYZ"
>>>   move the last img to 512, 600
>>>   delete img "iXYZ"
>>> end mouseUp
>>
>>
>> You can also
>>     Select the Image
>>     Group it
>>     Crop the group so that it shows only one of your sub images.
>>         In your example, that means you crop the group so that only 
>> pixels 1 thru 10 show.
>>     LOCK the group's size and position
>>     Change the location of the image
>>         In your example, that would mean subtracting 10 from the 
>> image's LEFT.
>>         Each time you do that this would have the effect of stepping 
>> through the 'frames' of your 'movie'.
>>         Do it rapidly and you can make a kind of animation from a 
>> single image.
>>
>>
>> Jim Lambert

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list