[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Image manipulation



Chris Nandor writes Mon, 21 Sep 1998 12:15:00 -0400:

>At 13.10 -0400 1998.09.21, w e b s l a v e wrote:
>>If not, I know clip2gif could do it, but I shudder a bit about creating
>>a MacPerl glue for it... anyone tried this before?
>
>You could try my app glue alpha stuff. :-)

Well, here is an AE Build which works, rescaling a JPEG file and saving it
as a GIF, using 'clip2gif';

#!perl
use Mac::AppleEvents;

$f_orig = 'Mactivity:Desktop Folder:original.jpg';
$f_half = 'Mactivity:Desktop Folder:half_size.gif';

$obj = "obj {want:type(file), from:'null'(), form:name, seld:'TEXT'(\@)}";

$evt = AEBuildAppleEvent(
    'core', 'save', 'sign', 'c2gf', 0, 0,
    "'----':$obj, fltp:type(GIFf), kfil:$obj, scle:50",
    $f_orig, $f_half
) or die $^E;

$rep = AESend($evt, kAEWaitReply) or die $^E;

AEDisposeDesc $evt;
AEDisposeDesc $rep;

I have tried the following using Glue (alpha 19980918):

#!perl
use Mac::Glue::clip2gif;

my $f = new Mac::Glue::clip2gif;
$f->open('Mactivity:Desktop Folder:original.jpg');
$f->save(
    'Mactivity:Desktop Folder:original.jpg',
    'undef', #colors
    '50',    #scale
    'undef', #quality
    'undef', #drawing
    'undef', #interlacing
    'undef', #renaming -- should this be 1 I wonder?
    'GIFf',  #as
    'undef', #crop
    'undef', #depth
    'Mactivity:Desktop Folder:half_size.gif', #in ('kfil')
    'undef', #max size
    'undef', #transparency
    'undef'  #dithering
);

However this does not work. What I am doing wrong? The 'open' works, (which
sort of proves the thing is set up right) but the 'save' does not.

Although this fails, I think the scheme looks very promising. It would be
nice if a way could be found so that parameters not involved could be
ignored (rather than explicitly undefined). But having said that I can't
see a neat way of doing that.

Alan Fry



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch