Hi,

Here's an approach, quite similar to Jim's. It should be easily adjustable to use any object (e.g. a rectangular graphic) to determine the target dimensions. E.g., you could replace the line starting with "put rescale" with the follwing:

put rescale(the formattedWidth of img 1,the formattedHeight of img 1, \
the width of grc "Some Rectengular Graphic",the height of grc "Some Rectengular Graphic") \
     into myNewRect



on mouseUp
answer file "Select a picture" with type "PNG file|png|PNGf" or type \ "GIF file|gif|GIFf" or type "JPEG file|jpg|JPEG" or type "All files|*|*"
     lock screen
     if it is not empty then
          set the filename of img 1 to it
put rescale(the formattedWidth of img 1,the formattedHeight of img 1, \ the width of this cd,the height of this cd) into myNewRect
          set the width of img 1 to item 1 of myNewRect
          set the height of img 1 to item 2 of myNewRect
          set the loc of img 1 to the loc of this cd
          unlock screen
          export img 1 to myPict as PNG
          ask file "Save as..." with "test.png"
          if it is not empty then
               put it into myFile
               open file myFile for binary write
               write myPict to file myFile
               close file myFile
          end if
     end if
end mouseUp

function rescale theImgWidth,theImgHeight,theCdWidth,theCdHeight
     -- put the executioncontexts
     -- determine longest side and rescale
     if theCdWidth/theImgWidth < theCdHeight/theImgHeight then
          put theCdWidth / theImgWidth into myRatio
     else
          put theCdHeight / theImgHeight into myRatio
     end if
     put theImgWidth * myRatio into myNewWidth
     put theImgHeight * myRatio into myNewHeight
     return myNewWidth,myNewHeight
end rescale

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum

New: Snapper Screen Recorder 2.0.1
Download at http://snapper.economy-x-talk.com

On 18 mei 2009, at 19:47, J. Landman Gay wrote:

I have a customer project that displays scanned images and photos of varying dimensions. These files are usually huge, with formatted sizes in thousands of pixels. I need a way to change the image resolution, or otherwise reduce the file size, so that the images can be rewritten to disk with a much smaller footprint in order to fit them on a single CD. But I need to preserve the original dimensions in inches, so that they will still print at their actual, original size. I think I need to determine the original resolution so that I can calculate the dimensions in inches, right? Is there a way to get that?

--
Jacqueline Landman Gay         |     [email protected]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to