How resize an image in pivot

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How resize an image in pivot

Santosh
Hi,
Can we resize an image in pivot ?

--
Thanks & Regards
B.S.V.S.Pavan Raju.
Skype: skype_pavan1
Hyderabad.
santosh pavan raju
Reply | Threaded
Open this post in threaded view
|

Re: How resize an image in pivot

cbartlett
Your question is currently too vague to answer.

When you say 'image' are you talking about using the org.apache.pivot.wtk.ImageView component?
Or possibly working with instances of the org.apache.pivot.wtk.media.Image class?
Or just generic 'image' processing in a Java application (that happens to be using Pivot for its UI)?
Have you already tried doing something using Pivot that is not working as expected?

Chris
Reply | Threaded
Open this post in threaded view
|

Re: How resize an image in pivot

Santosh
Hi Chris,
Iam using File Browsing option of Pivot, in my Application to select an image file and then to set the selected image file to ImageView. And i was able to do this. Now iam saving this image file and want to display it in a TableView cell. So i want to reduce the size of the Image before adding to it a tableview cell. Is there any direct way of changing the Image file so that i can add this to tableview cell.
santosh pavan raju
Reply | Threaded
Open this post in threaded view
|

RE: How resize an image in pivot

Roger Whitcomb-2
Hi Santosh,
        You can always set the "width" and/or "height" of the ImageView
itself and it will automatically resize the image to that/those
dimensions.  Usually you can just set one or the other and it will be
resized proportionally.

HTH,
~Roger Whitcomb

-----Original Message-----
From: Santosh [mailto:[hidden email]]
Sent: Tuesday, July 30, 2013 4:27 AM
To: [hidden email]
Subject: Re: How resize an image in pivot

Hi Chris,
Iam using File Browsing option of Pivot, in my Application to select an
image file and then to set the selected image file to ImageView. And i
was able to do this. Now iam saving this image file and want to display
it in a TableView cell. So i want to reduce the size of the Image before
adding to it a tableview cell. Is there any direct way of changing the
Image file so that i can add this to tableview cell.



-----
santosh pavan raju
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/How-resize-an-image-in-pi
vot-tp4022657p4022659.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: How resize an image in pivot

Erik Innocent
Santosh, you may also find the ScaleDecorator to be useful as a means for abstracting out the notion of scale from the ImageView itself. You can do this to any (I believe) component via something like:

float scale = x; // where x = 1 means no change
ScaleDecorator sd = new ScaleDecorator();
component.getDecorators().addDecorator(sd);

I've found that, after applying the Decorator, doing sd.setScale(y) will change the presentation of the ImageView more or less immediately.

Though if you want to resize the *image files* (and not the image views) such that the original files have a smaller footprint in memory, you will need an image manipulation library, which (I believe) goes beyond the scope of Pivot.

Warning: I'm relatively new to Pivot =D

Cheers,
--E



On Tue, Jul 30, 2013 at 11:06 AM, Roger L. Whitcomb <[hidden email]> wrote:
Hi Santosh,
        You can always set the "width" and/or "height" of the ImageView
itself and it will automatically resize the image to that/those
dimensions.  Usually you can just set one or the other and it will be
resized proportionally.

HTH,
~Roger Whitcomb

-----Original Message-----
From: Santosh [mailto:[hidden email]]
Sent: Tuesday, July 30, 2013 4:27 AM
To: [hidden email]
Subject: Re: How resize an image in pivot

Hi Chris,
Iam using File Browsing option of Pivot, in my Application to select an
image file and then to set the selected image file to ImageView. And i
was able to do this. Now iam saving this image file and want to display
it in a TableView cell. So i want to reduce the size of the Image before
adding to it a tableview cell. Is there any direct way of changing the
Image file so that i can add this to tableview cell.



-----
santosh pavan raju
--
View this message in context:
<a href="http://apache-pivot-users.399431.n3.nabble.com/How-resize-an-image-in-pi vot-tp4022657p4022659.html" target="_blank">http://apache-pivot-users.399431.n3.nabble.com/How-resize-an-image-in-pi
vot-tp4022657p4022659.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How resize an image in pivot

cbartlett
On 30 July 2013 18:49, Erik Innocent <[hidden email]> wrote:
<snip> 
Though if you want to resize the *image files* (and not the image views) such that the original files have a smaller footprint in memory, you will need an image manipulation library, which (I believe) goes beyond the scope of Pivot.


This is correct. Pivot does not provide direct image manipulation functionality, but it shouldn't take too long to find some generic example code on Stack Overflow or a similar site if you just need to essentially create a thumbnail from a larger image.  

Or you could just look at the source of Pivot's ImageViewSkin to see how it scales images internally.

If the resolution or memory footprint of the image is not a problem, then just configure the ImageView to resize as Roger said.

Chris