How to resize an image? solved.
Claus Dreischer
claus at dreischer.de
Sun Jun 27 11:42:58 EDT 2004
>Hallo Claus,
Hi Klaus,
(thanks for your time on this warm and not so rainy sunday :-)
...
>>Has anyone an elegant way to save a thumbnail of an image?
>
>There are probably 2 (or more ;-) ways to do this...
>
>1. Use Trevors excellent QT External to create a preview image of ANY size...
I was looking for an elegant/Transcript-only solution.
An external would have been the last resort ...
>2. Built-in solution: no external required :-)
>
>Size your original image as you like (lock loc!)
>Create a new image and script:
>
>...
>set the width of img "the new one" to the widht of img "the original one"
>set the height of img "the new one" to the heigth of img "the original one"
>
>set the imagedata of img "the new one" to the imagedata of img "the
>original one"
>...
>
>Now you have a new image that you can export as jpg or do whatever
>you want with :-)
>
>Hope that helps...
That's exactly what i was looking for!
I haven't found it in the transcript dictionary when i was searching
for a solution,
but there you can read:
"
The imageData, unlike the contents of the image container, is based
on the picture as it's presented on the screen, not stored in the
image object. This means that if you resize an image, the content of
the image does not change, but its imageData does. If you create an
image and then reduce its size, its imageData reflects the
scaled-down, displayed image, not the original full-scale image. If
you create a second image and set its imageData property to the
imageData of the original image, resizing the first image back to the
original dimensions displays the original image at full resolution,
but resizing the second image does not, because setting its imageData
transferred only the scaled-down version of the original.
"
So, again, beeing able to read is a clear advantage X-)
Danke!
Regards,
Claus.
More information about the use-livecode
mailing list