New topic: 

Reside Picture

<http://forums.realsoftware.com/viewtopic.php?t=39280>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        KikoLobo          Post subject: Reside PicturePosted: Wed Jun 
01, 2011 5:06 pm                         
Joined: Sat Oct 01, 2005 12:51 am
Posts: 163
Location: Monterrey, Mexico                Hi all..

Any idea, how can i resize a picture to fit a certain container?

Let's say a user uploaded a 1024x768 size and I want to resize it in code to 
800x600 before storing the picture on the database or before showing it to the 
user... Note that I don't want to crop it but resize it... Any clues on how to 
do this?

Thanks!      
_________________
------------------ 
Do what you can with what you have. 
Its often more than enough.  
                             Top                kermit          Post subject: 
Re: Reside PicturePosted: Wed Jun 01, 2011 11:58 pm                         
Joined: Mon May 30, 2011 12:56 am
Posts: 7                create a new picture of the required end size.
Use drawpicture to draw the original onto the new picture
save the new picture

Code:dim smaller as picture
smaller = new picture(800,600,32)
smaller.graphics.drawpicture  
bigpicture,0,0,smaller.width,smaller.height,0,0,bigpicture.width,bigpicture.height

.now use smaller

Theres more to it if you want to keep the picture the right shape ( you need to 
reduce both the width and the height by the same ratio) but this will get you 
started   
                             Top                 KikoLobo          Post 
subject: Re: Reside PicturePosted: Thu Jun 02, 2011 12:52 am                    
     
Joined: Sat Oct 01, 2005 12:51 am
Posts: 163
Location: Monterrey, Mexico                Awesome.
 thanks!      
_________________
------------------ 
Do what you can with what you have. 
Its often more than enough.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to