Scaling images and printing...

Paul Dupuis paul at researchware.com
Thu Dec 18 17:43:16 EST 2014


I have a problem with scaling images and printing.

I have the following portion of code where tObj is an image and tPrecent
is a number from 5 to 400. It's purpose is to scale an image to a %
scale factor the user entered and it does so.
 
put the fileName of tObj into tFile
set the filename of tObj to empty
set the fileName of tObj to tFile
set the alwaysbuffer of tObj to true
put the loc of tObj into tLoc
set the width of tObj to (the width of tObj * (tPercent/100))
set the height of tObj to (the height of tObj * (tPercent/100))
--set the imagedata of tObj to the imagedata of tObj -- to fix the size
for printing
set the loc of tObj to tLoc

If I then print the card with the image on it, the image is printed at
it's original size rather than the scaled size. If I added the commented
line "set the imagedata of tObj to the imagedata of tObj" back in to
"fix" the size of the image to the scaled size, card prints with the
image at the scaled size. Yea!

However, with the "set the imagedata of tObj to the imagedata of tObj"
line in the script, if the user resizes again, so the code above is
called with a different scaling factor, the image vanishes (or appears to).

The intent of the lines:
put the fileName of tObj into tFile
set the filename of tObj to empty
set the fileName of tObj to tFile

was to set the image back to its original size each time before scaling
so that the scaling would always be against the original image size (not
against it;s currently scaled size).

Is there a better way to allow users to rescale an image from it's
original size and still fix its size for printing?





More information about the use-livecode mailing list