[Yanel-dev] Re: Use of ImageMagick with Yanel/Yarep

Mehmet Birgi mehmet.birgi at wyona.com
Thu Jun 24 13:47:02 CEST 2010


Hi

Here is some more important information about the use of im4java:
additionally to im4java.jar, also a conventional installation of
ImageMagick is needed on every computer where the application will be
used, especially on the server machine. On Unix/Linux systems,
ImageMagick can be installed with "sudo aptitude install imagemagick"
(on Macs try MacPorts, i.e. "sudo port install imagemagick).

Question: is there a platform independent way to integrate this into
the Yanel build system?

Cheers,

Memo



On Thu, Jun 17, 2010 at 8:41 AM, Mehmet Birgi <mehmet.birgi at wyona.com> wrote:
> Hi all
>
> We recently had to implement some image scaling for a client project
> where image quality is very important. After first trying the standard
> tools that come with java.awt, since the results were not
> satisfactory, we switched to the ImageMagick tool. We implemented IM
> through the java interface im4java, and in the end, it worked just
> fine.
>
> The main difficulty was that the straightforward use of im4java needs
> absolute file paths as input and output, as im4java is basically a
> wrapper for the IM command line tool. Of course, this is not possible
> to do through Yarep, as it breaks the decoupling of the repository
> implementation. Luckily, we found out that im4java has an interface
> that allows piping of input and output streams, that can be used as
> follows:
>
>        // create the operation, add images and operators/options
>        IMOperation op = new IMOperation();
>        op.addImage("-");
>        op.resize(newWidth,newHeight);
>        op.addImage("-");
>
>        // create the pipes
>        InputStream is = getRepoNodeInputStream(sourceImageRepoPath);
>        Pipe pipeIn  = new Pipe(is, null);
>        OutputStream os = getRepoNodeOutputStream(targetImageRepoPath);
>        Pipe pipeOut = new Pipe(null, os);
>
>        // execute the operation
>        ConvertCmd cmd = new ConvertCmd();
>        cmd.setInputProvider(pipeIn);
>        cmd.setOutputConsumer(pipeOut);
>        cmd.run(op);
>        is.close();
>        os.close();
>
> I hope that this might be helpful if anybody else has the same problem.
>
> Cheers,
>
> Memo
>
>
>
> --
> Mehmet Birgi
> www.wyona.com
>



-- 
Mehmet Birgi
www.wyona.com


More information about the Yanel-development mailing list