Re: [PEPr] Images::Imagick proposal, functionnals

From: Date: Mon, 03 May 2004 22:26:06 +0000
Subject: Re: [PEPr] Images::Imagick proposal, functionnals
References: 1  Groups: php.pear.dev php.pear.dev php.pear.dev php.pear.dev 
Request: Send a blank email to pear-dev+get-28743@lists.php.net to get a copy of this message
> proposal: http://pear.php.net/pepr/pepr-proposal-show.php?id=64 > > I also hope to get some input on "Image_Magick_Conjure" by Florent Monnier. > He doesn't use a PEAR-Imagick-Api right now and it would be nice to get > together somehow. ==( Misc suggestions / discusses )== => Managing the greedyness Some functions are very greedy, like for exemple oilpaint, medianfilter, reducenoise, etc.. very *far* more greedy than all the other ones. I think it could be a good idea to add a switch to provide the possibility to disallow those for a web usage. The default could be allow greedy funcs of course, and a switch like this: $im->allowGreedyFuncs(FALSE); or $im->disallowGreedyFuncs(); (or perhpas a name with 'slow' I don't know) I had this in mind for when I would have start the web interface of Conjure. => starting the class Currently this small script will produce an error with the destructor: <?php require_once 'Imagick.php'; $im = &new Image_Imagick('./pearsmall.gif'); ?> I have seen giving the image filename to the constructor Image_Imagick() is not optional, while it is in loadImage(). IMHO this is an error. What about common IM starting images with: xc, gradient, plasma, plasma ? [1] And the Anthony Thyssen's technics? echo "P3 2 2 255\n0 220 240 0 140 150 0 140 150 0 80 80" | \ convert -geometry 512x512 - miff:- | display Yes I know all those above are just bringing pecl::imagick to segFault, but I think you should consider the shining futur where it will work, like in the mature Perl IM api. I know that php-imagick hardly lacks compared to the IM's Perl equivalent, but IMHO we should provide the blob functions even if those seg-faults on these entries, and if the user trys a blob('plasma:fractal') say him it is not available yet in pecl-imagick, if he trys a glob('gradient:#0f8-#08f') writing a macro to provide this until this one would be implemented in pecl-IM, and if the user trys a blob('xc:#38B') redirect it to getCanvas. Creating images base with blobs is a very common thing for every-day IM users. Nevertheless it *is* possible to create an image from scratch yet in pecl->IM with the base function getCanvas, and then to enhance it further with all the draw functions. The IM bezier draw functions have not been writen yet, but it is yet possible to blob a dynamicly generated SVG string into the blob IM-pecl function. It does work. In this case too, the constructor should not be feed with an image filename. Back to the filename entry problem in loadImage() the img-file-name to load is optional, which I find quite illogical. I have just wrote the loadImageData() function which I will have to use in Image_Magick_Conjure, I have also added printImage() build on image2blob which other user will need to send img to browser without caching it (img from a DB or else). I don't know what would be the good name for this one tmp name 'printImage', I have not checked yet how it is named in Perl-IM (not have to cut-past it, but should be interesting), also have to check how the equivalent is called in php-GD. Idem for the loadImageData() name which is the style name of this current class. Wouldn't the standard blob() name be preferable? For the filename entry, perhaps it should be optional in the constructor, and necessary in the loadImage() method? What do you think? On this at first I though when an img filename is given to the constructor, it should call, loadImage(), but then now I think a user could also want to given the new image-name he want to create and does not exists yet, then use gradient:, annotate, dyn-svg or draw, and then saveImage =( ENDOF Misc )= No comments about the pear error handling system. I am not used to it at all yet. (I have started to read its doc some weeks ago, but I have to seriously look into it to learn how it works and make experimentations on it.) So I 100% trust in you for this part to be correct ;-) Cheers++ __________ References [1] : On command line this looks like: convert -size 600x450 plasma:fractal fractal.jpg convert -size 600x450 plasma:tomato-dodgerblue plasma.jpg convert -size 600x450 gradient:#0f8-#08f png:- | display - And with Perl this work just fine: #!/usr/bin/perl -w use Image::Magick; $img = Image::Magick->new(size => "600x450"); #$img->ReadImage('xc:#38B'); # Plain color background #$img->ReadImage('gradient:#0f8-#08f'); # Gradient background #$img->ReadImage('plasma:fractal'); # Fractal background $img->ReadImage('plasma:tomato-dodgerblue'); # Plasma background $img->Write(filename => "image.MFS.png"); # Magick From Scratch :)

« previous php.pear.dev (#28743) next »