Scaled image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Scaled image

dario trussardi
Ciao,

        after upload an image ( with MAFileDescription support )

        i need to create the relative logo image with specific size 128 x 128 px.

        How i can scale the image into Pharo?

        And for deployment system based on Gemstone ?

        Thanks,

                Dario

Reply | Threaded
Open this post in threaded view
|

Re: Scaled image

kilon.alios
Morphs have an extent method that you can passes the size as a point in the x@y format, there are also width: and height: methods that take simple numbers

On Thu, Dec 22, 2016 at 6:02 PM Trussardi Dario Romano <[hidden email]> wrote:
Ciao,

        after upload an image   ( with MAFileDescription support )

        i need to create the relative logo image with specific size 128 x 128 px.

        How i can scale the image into Pharo?

        And for deployment system based on Gemstone ?

        Thanks,

                Dario

Reply | Threaded
Open this post in threaded view
|

Re: Scaled image

dario trussardi
Ciao,


Morphs have an extent method that you can passes the size as a point in the x@y format, there are also width: and height: methods that take simple numbers

Can explain what i need do  with some code, example ?

After the scaled i need to save the new scaled image on the disk.

Thanks


On Thu, Dec 22, 2016 at 6:02 PM Trussardi Dario Romano <[hidden email]> wrote:
Ciao,

        after upload an image   ( with MAFileDescription support )

        i need to create the relative logo image with specific size 128 x 128 px.

        How i can scale the image into Pharo?

        And for deployment system based on Gemstone ?

        Thanks,

                Dario


Reply | Threaded
Open this post in threaded view
|

Re: Scaled image

Stephan Eggermont-3
In reply to this post by dario trussardi
On 22/12/16 17:01, Trussardi Dario Romano wrote:
> Ciao,
>
> after upload an image ( with MAFileDescription support )
>
> i need to create the relative logo image with specific size 128 x 128 px.
>
> How i can scale the image into Pharo?

You can, but you might not want to. Scaling images is rather slow, you
often want an external process for that, especially if you want to
operate from disk to disk. You do not want to block your image too long,
and you might want to have your front-end web server serve those logo's
instead of your smalltalk image.  ImageMagick can be useful there.

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Scaled image

Henrik Nergaard-2
In reply to this post by dario trussardi

You can use WarpBlt to scale the form.

 

| input output |

 

input :=  Smalltalk ui icons iconNamed: #class.

output := Form extent: 128 asPoint depth: 32.

 

(WarpBlt toForm: output)           

                                sourceForm: input;

                                cellSize: 1;

                                combinationRule: Form over;

                                copyQuad: input boundingBox innerCorners toRect: (0 asPoint extent: 127 asPoint).

 

output writePNGFileNamed: 'somefile.png'

 

Best regards,

Henrik

 

 

 

From: Pharo-users [mailto:[hidden email]] On Behalf Of Trussardi Dario Romano
Sent: Thursday, December 22, 2016 6:45 PM
To: Any question about pharo is welcome <[hidden email]>
Subject: Re: [Pharo-users] Scaled image

 

Ciao,

 



Morphs have an extent method that you can passes the size as a point in the x@y format, there are also width: and height: methods that take simple numbers

 

            Can explain what i need do  with some code, example ?

 

            After the scaled i need to save the new scaled image on the disk.

 

            Thanks

 

 

On Thu, Dec 22, 2016 at 6:02 PM Trussardi Dario Romano <[hidden email]> wrote:

Ciao,

        after upload an image   ( with MAFileDescription support )

        i need to create the relative logo image with specific size 128 x 128 px.

        How i can scale the image into Pharo?

        And for deployment system based on Gemstone ?

        Thanks,

                Dario