Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Aug 17, 2018 8:36 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ImageView and Scaled Pictures
PostPosted: Mon Oct 08, 2012 12:16 pm 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
I scale into a ImageView any picture that I need to put in there, but ImageView turns out a worst image than the original.
If I do the scaled process externally with Preview app in Mac, ImageView displays a perfect image because it fits 100%.
Pictures are JPEG.
No problems in Canvas or ImageWell in RS.

I use these lines of code:
Function ScalePic (pic as picture) as Picture
Dim p as New Picture (400,300,32)
p.graphics.DrawPicture(pic,0,0,p.width,p.height, 0,0, pic.width, pic.height)
Return p

Any comments will be appreciated.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Mon Oct 08, 2012 3:41 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
What is the size of the original picture? Are you scaling up or down?

I suspect that are scaling up and that will always look bad because it's pixelating the image. But, we need more information to determine.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Mon Oct 08, 2012 6:14 pm 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
Hello Bob, I am always scaling down. The picture is a JPEG of 4000x3000 pixels, Resolution 180 pix./inch. and file size = 2,5 MB
I scale down to 400x300 pixels. As you say, pixelating is the right word to describe the loose of quality of the final image.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Mon Oct 08, 2012 10:52 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
Can you post or make available an original image and the resulting output?

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Tue Oct 09, 2012 4:46 am 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
You may find here below the links to my DB of both images. I added a third one to show how the scale results should be.

This is the original one.
http://db.tt/4V33a4f0

This is the screen shot of the imageView with the result of the scaled to 400x300 pixels.
http://db.tt/Os1sQ8Vk

This one is the result of the original image scaled with Preview (MAC app.) to 400x300 pixels.
http://db.tt/1NNgPGgh

It's a sort of graphics behavior I am not able to understand. For sure I'm missing something.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Tue Oct 09, 2012 7:42 am 
Offline

Joined: Tue Jan 24, 2006 11:04 am
Posts: 119
Location: Singapore
Have a look at this post, about half way down. Real uses different graphics engines depending on the platform and Web Edition.

viewtopic.php?f=1&t=44526&hilit=graphics

I found the same as you did: that graphics scaled down in Web Edition use a very basic scaling method that results in jagged edges. You'll need to code some binear interpolation routine or similar if you want better quality. You should find some code examples on the web.

_________________
RealStudio Enterprise Latest Version Windows 7 64bit sp1
http://www.sorted.com.sg


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Wed Oct 10, 2012 12:46 am 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
Thanks plim for the remarked post. Unfortunately, scaling pictures is the basis of my project and I cannot miss it out.
I will try to find a solution in the web to "fight" against this "aliasing" or jagged edges in the scaled images.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Wed Oct 10, 2012 1:51 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
Alfons wrote:
Thanks plim for the remarked post. Unfortunately, scaling pictures is the basis of my project and I cannot miss it out.
I will try to find a solution in the web to "fight" against this "aliasing" or jagged edges in the scaled images.


If you don't find any other solutions there are two that I thought of:
1. Depending on the system of the server you app runs on there might be applications to use in a shell.
2. I've used Sencha SRC to scale pictures. It's a free online service for scaling DOWN pictures in a simple way using HTTP. http://docs.sencha.io/current/index.html#!/guide/src

EDIT: It seems that Sencha is giving jaggered edges too :/
Here's your image scaled to w300 using Sencha SRC with this URL: http://src.sencha.io/300/http://db.tt/4V33a4f0:
Image

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Wed Oct 10, 2012 6:08 pm 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
Thanks Akiland for your suggestions. I also was thinking of any shell application could be a possible "exit" to this issue. Pictures uploaded from the users is the foremost part of the project, and the majority of the images should be scaled down.
I will test your second option of Sencha SRC and see what happens.
It's a pitty that WE works with a different graphic engines than RS, but I have to find the way to work this out.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 12:18 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
Alfons wrote:
Thanks Akiland for your suggestions. I also was thinking of any shell application could be a possible "exit" to this issue. Pictures uploaded from the users is the foremost part of the project, and the majority of the images should be scaled down.
I will test your second option of Sencha SRC and see what happens.
It's a pitty that WE works with a different graphic engines than RS, but I have to find the way to work this out.

What system will your app be hosted on? :)

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 12:46 am 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
MBS or Einhugur plugins might have a console app compatible image scaling function. I know they have image scaling, and I can check to see if it works in WE if you like.

Web Custom Controls lets you set image size on the browser client, and the image will use the browser's scaling. This doesn't necessarily help with bandwidth, but is the way to go if one image will be repeatedly displayed at different sizes. You can load the image into the client's browser cache once, then change the size on the client side via RB code at any time.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 6:19 am 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
Akiland wrote:
Alfons wrote:
Thanks Akiland for your suggestions. I also was thinking of any shell application could be a possible "exit" to this issue. Pictures uploaded from the users is the foremost part of the project, and the majority of the images should be scaled down.
I will test your second option of Sencha SRC and see what happens.
It's a pitty that WE works with a different graphic engines than RS, but I have to find the way to work this out.

What system will your app be hosted on? :)



Excuse me Akiland, I forgot your question :oops: . The application will run in a Linux VPS.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 6:30 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
Alfons wrote:
Akiland wrote:
Alfons wrote:
Thanks Akiland for your suggestions. I also was thinking of any shell application could be a possible "exit" to this issue. Pictures uploaded from the users is the foremost part of the project, and the majority of the images should be scaled down.
I will test your second option of Sencha SRC and see what happens.
It's a pitty that WE works with a different graphic engines than RS, but I have to find the way to work this out.

What system will your app be hosted on? :)



Excuse me Akiland, I forgot your question :oops: . The application will run in a Linux VPS.

Nice! Then you should be able to use Imagemagic in a shell :)
It's a free Command Line application for image manipulation.
http://www.imagemagick.org/script/index.php
http://www.imagemagick.org/Usage/resize/

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 8:58 am 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
taylor-design wrote:
MBS or Einhugur plugins might have a console app compatible image scaling function. I know they have image scaling, and I can check to see if it works in WE if you like.

Web Custom Controls lets you set image size on the browser client, and the image will use the browser's scaling. This doesn't necessarily help with bandwidth, but is the way to go if one image will be repeatedly displayed at different sizes. You can load the image into the client's browser cache once, then change the size on the client side via RB code at any time.

Daniel, thanks for your comments. Einhugur told me that PictureEffects RealBasic plug-in will not work in Web Edition. I don't know MBS, I have to check it with Christian from MBS.
Pictures are uploaded by users and immediately scaled and saved into a DataBase, so images will always have the correct size to be visualized later on in the ImageView. I pretend making this operation as simple as it allows to be.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageView and Scaled Pictures
PostPosted: Thu Oct 11, 2012 9:04 am 
Offline

Joined: Fri Oct 01, 2010 11:34 am
Posts: 65
Excuse me Akiland, I forgot your question :oops: . The application will run in a Linux VPS.[/quote]
Nice! Then you should be able to use Imagemagic in a shell :)
It's a free Command Line application for image manipulation.
http://www.imagemagick.org/script/index.php
http://www.imagemagick.org/Usage/resize/[/quote]

Great! I have to visit the link and learn how it works.
Thanks for your help.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group