Image = JAI.create("stream",bass) problem

I get the exception "Stream - Parameter value`s class (com.sun.media.jai.codec.ByteArraySeekableStream) is not an instance of the parameter class (com.sun.media.jai.codec.SeekableStream) for parameter "stream".
" with the following code - not sure why - thanks in advance
ByteArraySeekableStream bass = new ByteArraySeekableStream
(fileData.toByteArray());
image = JAI.create("stream",bass);
Steve

I got this to work, but the above method should also work:
ByteArraySeekableStream bass = new ByteArraySeekableStream(imageData);
if ( imageFormat.compareToIgnoreCase(ImageAttributes.Format_JPEG) == 0 )
JPEGImageDecoder imageDecoder = new JPEGImageDecoder(bass,null);
RenderedImage ri = imageDecoder.decodeAsRenderedImage();
retValue = PlanarImage.wrapRenderedImage(ri);
}

Similar Messages

  • How to close pictures that are opened by JAI.create("fileload",filename)

    After doing some deletion tests, it seems that all picture I'm loading with
    JAI.create("fileload",filename) or JAI.create("filestore",pb) stay open and prevent me from deleting those pictures.
    Do you have an idea on how I could close those pictures ?
    thank you !
    Edited by: dnlfrnc on Feb 13, 2008 10:42 AM

    Short answer: you can't if you use JAI.create("fileload",filename) :you can't rely on making a call to the garbage collector, because you can't be sure it will work.
    Instead, use the sream operator:
           FileSeekableStream stream = null;
            try {
                stream = new FileSeekableStream(sourceImageFile.getAbsolutePath());
                // use the stream operator because the fileload operator does not allow to release the handle on the opened file
                PlanarImage input = JAI.create("stream", stream);
                // do your stuff
            } finally {
                // close the stream.
                stream.close();
            } Why you don't have any means (besides gc, but I don't call that an option) of releasing the handle on a file you opened with the fileload operator is beyond me, though (especially as this operator is widely used in the tutorials, and thus is bond to end up in a lot of code)

  • System Image Utility "Create" problem

    We have a new Xserve that we're finally going to be available to use for Open Directory/Net Boot/Net Install/etc in our coporate network. So, this is all new to me but I'm trying to make a Net Install image to export to the server.
    My G5 workstation (Mac OS X 10.4.6, but the imaged drive has 10.4.5) has two hard drives, one of which has our corporate image of software installed on it, "clean". The other hard drive is my own with lots of extra software and customization. I'm trying to use the System Image Utility (v. 10.4.4 (251)) to create an image. I am an administrator user on my computer. After configuring all the appropriate settings, I push the "Create" button and it appears to start working, prompts me for a location to save the actual image itself, creates a folder with the default name and then nothing happens. The spinning gear would seem to indicate that the System Image Utility is doing something, but the "Create" button continues to throb blue. I can click "Create" again and another folder is created when I'm promted to save the image and it continues to remain empty. All I can do is click "Cancel" and start over.
    I was quite frustrated until I logged into my computer as the local administrator user (this user is employed when we're configuring a workstation for the first time to give it the correct file sharing name and bind it to the Active Directory). Creating an image works just find while I'm logged in as the local administrator. (At least as far as creating/exporting the image, getting Net Boot to turn on the Xserve is proving a challenge.)
    So, is there something preventing network administrator users from creating images? I'd really rather have my own e-mail open and running as well as my own bookmarks while I'm working on a project like this, but it doesn't seem possible. Any tips would be appreciated.
    -Doug

    After configuring all the appropriate settings, I
    push the "Create" button and it appears to start
    working, prompts me for a location to save the actual
    image itself, creates a folder with the default name
    and then nothing happens.
    ok here's the deal: i created a folder in my OSX server home directory labelled "images" and keep our multiple images there. although you CAN have your images on other drives or on the network, that would take a LOOOOOOOONG time to do the data transfer to the invisible netboot folder on your server. my advice: keep local copies of all images. save a ton of time for yourself, eh?
    then, when it's time to use the system image suntility to load up an image, i go to that same location each time, call it up and have the app set to the prefs i want or need. i'm on 10.4.7 server and have had no problem using the software.
    so try using images locally and then, if that doesn't work, upgrade to 10.4.7

  • Cannot delete file after calling JAI.create() method

    hi all
    this is the first time i write to this list
    today i began to use the JAI api on a project
    it works fine but i am not able to delete a file after using it
    my code:
    for(int i=2; i<2+filenames.size(); i++)           
                    try
                        String fName=filenames.get(i-2).toString();                   
                        if(fName!=null)
                            File file=new File(uploadDir+"\\"+fName);
                            FileInputStream f=new FileInputStream(file);
                            ps.setBinaryStream(i, f,(int)file.length());
                            PlanarImage pi = JAI.create("fileload", uploadDir+"\\"+fName);
                            System.out.println ("heigh : "+pi.getHeight());
                            System.out.println ("width : "+pi.getWidth());
                            f.close();
                    catch(NullPointerException n)
                        n.printStackTrace();
                        return;
    for(int i=0; i<filenames.size(); i++)
                    String fName=filenames.get(i).toString();  
                    File file=new File(uploadDir+"\\"+fName);
                    if(file.delete())
                        System.out.println(fName+" deleted");
                    else
                        System.out.println(fName+" not deleted");                   
                               }i use this code in a servlet that receives an image to put it in a database.
    JAI is useful to get heigth and width of it.
    the problem is that i always get the "not deleted" message.
    i'm quite sure that is a problem of the bold code (JAI code), also because, cutting it, i can delete my file
    anyone could help me?
    thanx a lot in advance
    alessandro

    excuse me another time!
    my first post was right.
    i'm not able to delete an image after creating it with JAI.create();
    i'm still lookin' for a way to close all the references to my image in order to delete it
    how?
    thanx a lot
    sandro

  • Input needed reagrding JAI.create()

    Hello,
    Can any one pls let me knoe the list of operations that are supported by JAI.create("op",Obj).
    I have a problem in passing the byte[] to JAI.create().
    My issue is to pass byte[] constructed from an image thru FileI/O and then find out the height and width of the image using the byte[].
    Is this is possible, if yes can any one send some code snippet on how we can do that.
    ~Alapati

    Hi Venkata,
    I did such a thing twice and prefer solution 2.
    This is why:
    You have a fresh new box (no old/obsolete developments) , preferable the newest release and freedom to choose OS/DB combo. Transporting over releases never gave me much troubles. If one is experienced with the regular issues for TMS in BW no problem.
    Regards, Patrick Rieken.

  • JAI TIFF - JPEG colour problem

    Hi all...
    I want to use JAI to convert from TIFF to JPEG. Here is my test program:
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    import java.awt.image.renderable.ParameterBlock;
    public class Test {
         public static void main( String[] args ) {
              String srcFile = args[0];
              String dstFile = args[1];
              RenderedOp op = JAI.create( "fileload", srcFile );
              ParameterBlock p = new ParameterBlock()
                        .addSource( op )
                        .add( dstFile )
                        .add( "JPEG" );
              RenderedOp saveOp = JAI.create( "filestore", p );
    }It works fine, except the colours in the output are all wrong.
    After running
    java Test NEC_LCD3000+Soundb_R.tif bad.jpg
    my output looks like
    http://xtuml.jdns.org/bad.jpg (if you can even see it. Firefox refuses to display the image. Gimp and KView can open it though, but all the colours are messed up)
    The output should look like
    http://xtuml.jdns.org/good.jpg
    The original was ripped from NEC's website:
    http://www.nec-display-solutions.com/coremedia/download/18634/LCD3000-ProductPicture-Soundbar-Side-R-TIF.zip
    I suspect it's a problem to do with Color Models or something, but I'm way out of my depth in this area.
    Can anybody suggest a solution?
    Thanks in advance!
    Regards,
    James

    Maybe this is the problem... the original image has an alpha channel. When I used the GIMP to flatten it back to RGB (with no alpha channel), JAI works fine...
    Does JAI support RGBA? Am I posting in the wrong forum? Is the whole world against me? :P

  • JAI 1.1 Rotate Problems

    I am having difficulty with the border extender in conjunction with the rotate call.
    The produced image is always has a black background no matter which type of border extender I use. Has anyone come across this problem. Any solutions.
    Code:
    public static RenderedOp rotate(RenderedOp image, float angleDeg,
                                  Color bgColor) {
    float angleRad = (float)(angleDeg * (Math.PI/180.0F));
    ParameterBlock params = new ParameterBlock();
    params.addSource(image); // The source image
    params.add(image.getWidth()/2.0f); // The x origin
    params.add(image.getHeight()/2.0f); // The y origin
    params.add(angleRad); // The rotation angle
    params.add(new InterpolationNearest()); // The interpolation               
    BorderExtender extender =
    BorderExtender.createInstance(BorderExtender.BORDER_REFLECT);
    RenderingHints.Key extenderKey = JAI.KEY_BORDER_EXTENDER;
    RenderingHints renderHints =
         new RenderingHints(extenderKey, extender);
    return JAI.create("rotate", params, renderHints);
    Thanks,
    Zach Heath

    I've run into the same problem. Even the BorderExtenderConstant doesn't seem to do anything.

  • System Image Utility - Create User - Activate Remote Management

    When creating an image with system image utility, based on a DVD image instead of a cloned image, I cannot create a user and activate Remote Management.
    I have created an installer package with Apple Remote Desktop that is supposed to do both, however it doesn't work. I do not get an error, but no user is created.
    I have tried a post-install script however the dscl command is not recognized even if I put the path /usr/bin/dscl.
    I even tried to use a popular package out there called "createUser" but that fails as well.
    Has anyone had any luck with this when trying to make a moduler image with System Image Utility?
    Message was edited by: NeedSomeAnswer

    After configuring all the appropriate settings, I
    push the "Create" button and it appears to start
    working, prompts me for a location to save the actual
    image itself, creates a folder with the default name
    and then nothing happens.
    ok here's the deal: i created a folder in my OSX server home directory labelled "images" and keep our multiple images there. although you CAN have your images on other drives or on the network, that would take a LOOOOOOOONG time to do the data transfer to the invisible netboot folder on your server. my advice: keep local copies of all images. save a ton of time for yourself, eh?
    then, when it's time to use the system image suntility to load up an image, i go to that same location each time, call it up and have the app set to the prefs i want or need. i'm on 10.4.7 server and have had no problem using the software.
    so try using images locally and then, if that doesn't work, upgrade to 10.4.7

  • Image reclaim from database ,facing problem

    I am very much new in Flex development.........
    I am facing a problem from  quite a few days to  reclaim  a image from the database with the help of servlet to a flex application .  I am  using HttpRequest Object not  Blaze Ds.
    Actually image byte stream is comming back from Servlet to Flex   End  , but when I want to display it , then it shows the place of the image as black .I think image pixel's are not combining togather ..........Have you any Idea?
    I am trying in  the following way.......... this is in the result handler method................
    private function getPhotoResultHandler(event:ResultEvent):void{
                   try{                     
                              xmldata1=event.result as XML;   
                              mx.control.alert.show(xmldata1.toString);        //  Here I can see the  byte stream  in the browser                                                          
                              var byteData : ByteArray;                                                                                            
                              var dec : Base64Decoder  = new Base64Decoder();              
                              dec.decode(xmldata1.toString());                 
                              byteData = dec.toByteArray();                     
                              imggetPhoto.source=byteData;  
                catch( ex : Error )
              Alert.show( ex.message );

    Hi,
    I use Forms 6i to save and retrieve image in BLOB column without problems.
    Some weeks ago, my column was long raw and I update it without problems. Nothing to do in Forms and juste modifiy query and recompile in Reports.

  • Image 10.7.3. Problems with settings when new image is used on another mac

    10.7.3 image.I create an image of 10.7.3 using disk utility with the "Require an admin password to access system preferences" checked under Security and Privacy, once i move the image to another mac it reverts and unchecks the setting "Require an admin password to access system preferences. There is no problems creating the image or loading the image on new mac. There is something that is reverting the setting from original image on new mac. I am not using a 3rd party software to create an image. As what i understand the image should exactly the same. Not sure what is causing these problems since it only happens when using 10.7.3 and did not happend on 10.7.2. Any feedback will be appreciated. thanks

    Also AppleScript for QuickTime player control is broken. Instead of moving playhead forward, this AppleScript now moves it backward!
    set the increment_amount to 40
    tell application "QuickTime Player"
              try
                        ignoring application responses
                                  tell document 1
                                            set the movie_length to the duration
                                            repeat
      step forward by the increment_amount
                                                      if the current time is equal to the movie_length then exit repeat
                                            end repeat
                                  end tell
                        end ignoring
              end try
              try
                        ignoring application responses
      play document 1
                        end ignoring
              end try
    end tell

  • Socket Stream Communication Problem

    [My Server code]:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class testserv {
    public testserv() {
    public static void main(String[] args) {
    try {
    ServerSocket ss = new ServerSocket(8999);
    Socket so = ss.accept();
    System.out.println("accept");
    InputStream a = so.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(a));
    System.out.println(br.readLine());
    System.out.println(br.readLine());
    ObjectInputStream ois = new ObjectInputStream(a);
    String aa = (String)ois.readObject();
    System.out.println(aa);
    so.close();
    } catch (Exception e) {e.printStackTrace();}
    [My Client code]:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class testcli {
    public testcli() {
    public static void main(String[] args) {
    try {
    Socket so = new Socket("140.114.79.236", 8999);
    OutputStream out = so.getOutputStream();
    PrintWriter pw = new PrintWriter(out, true);
    pw.println("test");
    pw.println("test2");
    ObjectOutputStream oos = new ObjectOutputStream(out);
    oos.writeObject(new String("test3"));
    oos.flush();
    so.close();
    } catch (Exception e) {e.printStackTrace();}
    When i use client connect to server, the output should be
    accept
    test
    test2
    test3
    but the output is
    accept
    test
    test2
    java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2165)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2634)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
    at core.test.testserv.main(testserv.java:20)
    Is this stream's bug??
    Or what mistake do i make??
    Can somebody give me some advice??
    Thank you in advance :)

    you should have made a new thread of this.
    Hello All,
    Can anyone help?
    I'm implementing a chat program with swing, sockets
    and threads. I have got a basic version working
    perfectly. I decided to upgrade it to include a
    configuration (which is loaded and saved to file one
    way or another). This configuration makes a record of
    the users' favourite font.
    i assume this part works. :)
    In version.1 fonts were not implemented, so I was just
    reading and writing (printing) from and to the
    socket's I/O streams - no problem there.
    In version.2 I have implemented a Message class, which
    when sent contains the name of the sender (ie. what
    the sender signed in as) the actually message as a
    String, and a Font which is the font the sender uses.
    I have tried to use the socket I/O streams :
    1). to create Object I/O streams;
    2). to create Bean XMLEncoders and XMLDecoders.
    Neither of these two methods work and they are the
    only way I can think of achieving what I want to do.
    To be honest I don't know what happens - the JVM
    doesn't throw an exception, just the instance acting
    as the client hangs, while the instance acting as the
    server ticks over as per usual. If I end the client
    process (through task manager) an exception is thrown
    in the server.it sounds like:
    1. your server isn't very robust. :) any server operating in the real world should expect and deal with broken messages.
    2. you need to read up on ObjectInputStreams and ObjectOutputStreams. if you want to go that route, they're what you need to look at.
    personally, i'd recommend that you provide methods in the Message class to convert to and from a String, and send the Strings through a Writer attached to the socket. it's easier to recover from errors that way: you could throw a MessageFormatException or other such error without trashing your input stream. plus, it'd be easier to write non-java clients, in case you ever decide to go that route.

  • Creating streams and sensor data hub

    Hi all,
    I am working on the Getting Started example from OTN ( "HandsOnSession.pdf" )
    and in the step to create stream and sensor data hub, am having a problem.
    I am working with the Standalone SES v10.1.2 running on a Linux OS.
    While running this command at the Linux Terminal,
    sqlplus system/welcome1@orcl
    I get a -bash: sqlplus command not found error
    I am in the <filepath>/edge/sql $ when I execute it.But I observed that my Oracle edge server install folder doesnot have a sqlplus folder which I think is by default installed in the Oracle_Home folder. There is a sqlj folder though , but am not familiar much with sqlj.
    Could anyone advise on how to connect to the database and create he SDH tables.
    Also in the sqlplus system/welcome1@orcl command, could anyone confirm if the syntax is as below,
    sqlplus <username>/<password>@orcl
    where
    <username> = username used to install the Edge server install
    <password> = password used to install the Edge server install
    would appreciate your response,
    Thanks,
    Vijay

    Hi Vijay!
    The EdgeServer doesn't have a full Oracle installation. Therefore a client tool such as sqlplus is not present. Install a Oracle Database on this machine (as I suspect you do not have a database yet) and use the sqlplus it comes with.
    cu
    Andreas

  • JAI - Creating High Quality thumbnails

    I am using JAI to take in large images and proportionally resize it to around ~300 x 220 image.
    Using the "scale" returns horrible quality
    ParameterBlock pb2 = new ParameterBlock();
    pb2.addSource( src );
    pb2.add( scale );
    pb2.add( scale );
    pb2.add( 0.0f );
    pb2.add( 0.0f );
    JAI.create( "scale", pb2, null );Using "subsampleaverage" is much better, but still returns worse quality than the original.
    ParameterBlock pb2 = new ParameterBlock();
    pb2.addSource( src ); // The source image
    pb2.add( ( double ) scale ); // The xScale
    pb2.add( ( double ) scale ); // The yScale
    pb2.add( new InterpolationBicubic2(8) ); // The interpolation...I Tried all Interpolation Types already
    JAI.create( "subsampleaverage", pb2, null );I want an exact quality copy of the original. Is there a way to do this in JAI?

    I mean in photoshop it saves much clearer (higher
    quality image) than through JAI. I know in Photoshop
    you can choose clarity on a scale from 1 to 12 when
    saving image files for the web. The only thing I see
    in JAI is interpolation which provides 3 or 4 choices.Ah, you mean the JPEG codec quality level. JAI's JPEGTileCodecDescriptor has a quality resource:
    "A factor that relates to the desired tradeoff between image quality and the image data compression ratio. The range of this parameter is from 0.0 to 1.0. A setting of 1.0 produces the highest quality image at a lower compression rate. A setting of 0.0 produces the highest compression ratio, with a sacrifice to image quality. The default value is 0.75."

  • Have Operating System 10.6.8, Mail Program 4.6.  How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to m

    Have Operating System 10.6.8, Mail Program 4.6.
    How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to manually opening every few month with no ? action from me.
    Help

    Have Operating System 10.6.8, Mail Program 4.6.
    How can I prevent the next email in the que from automatically opening after I act on the previous email ? It creates big organizational problems for me. My computer changes this mode from self opening to manually opening every few month with no ? action from me.
    Help

  • Bass problem with s750 + Live 24

    Bass is way, way too strong. I have it turned down to the lowest setting on the s750 control box.
    Recently upgraded my computer. Before, I had an Audigy 2zs and was able to fix the bass problem by going to system volume settings and reducing Bass in the Advanced Tone Controls section.
    Now I have a Shuttle SD3P computer with an integrated Li've! 24 bit sound system. The Bass controls that worked for me on my last system are now greyed out and inaccessible. The "Subwoofer" volume slider in Creative's volume settings program does not work (doesn't matter if you move it all the way to the top or bottom, bass still sounds the same).
    Please help. This is a serious problem (bass is so loud as to be painful - any games or music with even minimal amounts of bass are unplayable because of the problem).

    Can anyone suggest possible fixes?
    I would greatly appreciate it!

Maybe you are looking for

  • How much Ram can I put in my 15inch early 2008 Macbook Pro

    Running a 2.4ghz Intel Core 2 Duo and currently 2gb 667 MHz DDR2 SDRAM.  It has 2 slots, whats the max I can put in?  What type of RAM do I purchase and who has the best Price on same. Thanks milehidef

  • Ios 7 problem I am facing

    I have an iphone5 running on ios7.0.2 .. They are still more problem.. The screen doesn't auto-lock and emoji keyboard can't be used.. If I use emoji symbols.. The phone restarts and sometimes the new quick access tool bar music control don't work ..

  • IPad2 using iOs 8 passcode problem

    I updated my iPad2 to iOs 8.02 and now I am having a problem.  It crashed and I got a message that it needed to be restored on iTunes.  I did and now I can't get into it again because it says that I am using the incorrect passcode.  I have tried so m

  • Inspection RR should be allowed for the operation confirmed qty only

    Hi  Friends I have one requirement , Inspection results recording should be allowed for the operation confirmed qty only i.e     1. Release Production Order for 100 qty     2. Inspection Lot created for 100 qty     3. Production Confirmation done for

  • The Index Server is in Read Only Mode

    Hi, In our test environment ALL of our jobs are failing. The message in every failed Job Log is: 11/18/05 10:25:15- Starting to run operations (1 total) for job 'Search Update 2 - Run Once'. Will stop on errors. (PID=14064)11/18/05 10:25:16- *** Job