Quantcast

Image setSize seems broken

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Image setSize seems broken

Robert van Heumen
Hi there,

I’m trying to resize images, but it seems the setSize method is broken. I can’t seem to find any posts on the subject. Does anyone know what’s the status of that?
Below is code from the helpfile, and it throws me an error. I’m on OS X 10.9.4 and SC3.8.0.

Thanks!
Robert

(
    i = Image.new(SCDoc.helpSourceDir +/+ "images/Swamp.png");
    i.bounds.postln; // getting the dimensions
    w =i.plot;
)

// changing the size of an image
(
    i.scalesWhenResized_(true);
    i.setSize(400, 400 / (i.width / i.height));
    a =i.plot;
)


ERROR: Primitive '_QImage_SetSize' failed.
Wrong type.
RECEIVER:
Instance of Image {    (0x112538778, gc=E4, fmt=00, flg=00, set=03)
  instance variables [5]
    dataptr : RawPointer 0x7f9e82e43e10
    finalizer : instance of Finalizer (0x119a82c68, size=2, set=1)
    name : nil
    url : nil
    scalesWhenResized : true
}
PATH: /Users/Robert/---data---/Audio/SC/Point-to-Line.scd
CALL STACK:
        MethodError:reportError   0x11161f198
                arg this = <instance of PrimitiveFailedError>
        Nil:handleError   0x1127be368
                arg this = nil
                arg error = <instance of PrimitiveFailedError>
        Thread:handleError   0x1143460e8
                arg this = <instance of Thread>
                arg error = <instance of PrimitiveFailedError>
        Object:throw   0x112938918
                arg this = <instance of PrimitiveFailedError>
        Object:primitiveFailed   0x1120676e8
                arg this = <instance of Image>
        Image:setSize   0x11512d7c8
                arg this = <instance of Image>
                arg width = 400
                arg height = 400
                arg resizeMode = 1
        < closed FunctionDef >  (no arguments or variables)
        Interpreter:interpretPrintCmdLine   0x1118b8a58
                arg this = <instance of Interpreter>
                var res = nil
                var func = <instance of Function>
                var code = "(
    i.scalesWhenResized_..."
                var doc = nil
                var ideClass = <instance of Meta_ScIDE>
        Process:interpretPrintCmdLine   0x11a7bed48
                arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Primitive '_QImage_SetSize' failed.
Wrong type.
RECEIVER: an Image








_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
*
Robert van Heumen
Composer and improvising musician
http://west28.nl/ 
http://shackle.eu/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image setSize seems broken

Robert van Heumen
Oops, found it. The arguments for setSize need to be integers. I got confused by the example.


*
Robert van Heumen
Composer and improvising musician
http://west28.nl/ 
http://shackle.eu/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Image setSize seems broken

LightRate
CONTENTS DELETED
The author has deleted this message.
Loading...