New to Get a Copy of Scaled Down Version of an Image
Richmond
richmondmathewson at gmail.com
Wed Oct 28 09:29:42 EDT 2020
https://www.dropbox.com/s/gdrsa4git7l6war/imager.livecode.zip?dl=0
Richmond
On 28.10.20 13:34, Richmond wrote:
> Remember that you have to lock an image to stop it popping back to its
> original size.
>
> Or, alternatively, you could change the order of your code.
>
> Also, you have misspelt 'height' in "resizeToHeigth".
>
> Also, while you have defined "resizeToWidth", you don't appear to have
> defined "resizeToHeight" in the code you have posted.
>
> The whole procedure looks a bit wonky: so I shall "go away" and try my
> own version.
>
> Best, Richmond.
>
> On 28.10.20 12:28, Sannyasin Brahmanathaswami via use-livecode wrote:
>> Take for example
>>
>> [command] resizeToWidth tImage, 400
>>
>> on resizeToWidth pImage,pSize
>> local tOrigImgWidth, tOrigImgHeight, tRatio, tNewWidth, tNewHeight
>> set the itemdel to "x"
>> put item 1 of sCurrentGraphicRect into tOrigImgWidth
>> put item 2 of sCurrentGraphicRect into tOrigImgHeight
>>
>> if tOrigImgWidth is 0 then exit resizeToWidth
>>
>> put pSize/tOrigImgWidth into tRatio
>> put (tOrigImgHeight * tRatio) into tNewHeight
>> put (tOrigImgWidth * tRatio) into tNewWidth
>>
>> set the rect of pImage to 0,0,tNewWidth,tNewHeight
>>
>> end resizeToWidth
>>
>> How do I get a copy, with the image scaled down, which is visible on
>> screen?
>>
>> [coded]
>> if (the width of tImage > the heigth of tImage ) then
>> # portrait
>> resizeToWidth tImage, 400
>> else
>> # landscape
>> resizeToHeigth tImage, 400
>> end if
>>
>> # now we set the img to the img "currentpuzzle"
>> set the name of the last image to "currentpuzzle"
>>
>> # and copy the data, at 400px wide
>> put the rect of the last image into tImageData["rect"]
>> put the imageData of the last image into tImageData["image"]
>>
>> put tImageData["image"] into image "currentpuzzle"
>>
>>
>> BUT the full scaled copy of the image "currentpuzzle" comes into
>> view. I wanted to get a scaled down version?
>>
>>
>> Svasti Astu – Be Well
>> Brahmanathaswami
>>
>> Get SivaSiva.app – It free!
>> https://www.himalayanacademy.com/view/sivasiva
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list