• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Webobjects 5.2.4 and JAI
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Webobjects 5.2.4 and JAI


  • Subject: Webobjects 5.2.4 and JAI
  • From: "John Q." <email@hidden>
  • Date: Sat, 14 May 2005 11:11:21 +0200

Hi,
i try to use the Java Advanced Imaging api with webobjects 5.2.4 with Tiger OS.
I will scale at runtime image files that are stored in my SQL Database as a NSData.
If i call JAI.create("stream",is);
Webobjects starts the Bootstrap.jar and terminates my application.
I have no idea what´s the problem.

I hope someone can help me!

Thanks,
Raphael

Code:
    public NSData scaleDownToSize(int width, int height, NSData data){
        try{
            InputStream is = new ByteArrayInputStream(data.bytes(),0,data.length());
            SeekableStream s = SeekableStream.wrapInputStream(is, true);
            RenderedOp objImage = JAI.create("stream", s);
            ((OpImage)objImage.getRendering()).setTileCache(null);

            

            //scale 100
            float xScale = objImage.getWidth()/width;
            float yScale = objImage.getHeight()/height;

            

            ParameterBlock pb = new ParameterBlock();
            pb.addSource(objImage); // The source image
            pb.add(xScale);         // The xScale
            pb.add(yScale);         // The yScale
            pb.add(0.0F);           // The x translation
            pb.add(0.0F);           // The y translation
            pb.add(new InterpolationNearest()); // The interpolation 

            

            objImage = JAI.create("scale", pb, null);

            

            ByteArrayOutputStream stream = new ByteArrayOutputStream();

                

            JAI.create("encode", objImage, stream, "TIFF", null);

            

            byte[] imageBytes = stream.toByteArray(); 
            NSData result = null;//new NSData(imageBytes);

            return result;
        } catch(Exception e){
            System.out.println(e);
            NSData result = null;
        }

        

        return null;
    }

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Webobjects 5.2.4 and JAI
      • From: Mike Schrag <email@hidden>
  • Prev by Date: Re: Fetch Specs and Limits
  • Next by Date: Multiple model approach
  • Previous by thread: D2W failure
  • Next by thread: Re: Webobjects 5.2.4 and JAI
  • Index(es):
    • Date
    • Thread