1 Reply Latest reply: Apr 26, 2011 10:35 AM by Mannamal-Oracle RSS

    How to crop image?

      My code:
      vPhoto blob default null;
      image1 ORDSYS.ORDIMAGE;
      image2 ORDSYS.ORDIMAGE;

      select content into vPhoto from directory.staff_pic where id=pid ; -- Pid is a parameter

      select ordsys.ordimage(Ordsys.Ordsource( vPhoto, null, null, null, null, 1),
      null, null, null, null, null, null, null)
      into image1 from dual;
      image1.setProperties( );

      image1.processCopy('cut=0 0 70 70' , image2);

      And I got error msgs:

      Failed to execute target procedure ORA-06510: PL/SQL: unhandled user-defined exception
      ORA-06512: at "ORDSYS.ORDIMAGE", line 71
      ORA-06512: at "DIRECTORY.TEST", line 179
      ORA-06512: at line 33

      so what should I do to "Crop" it?
      and save it as a new pic (but smaller)

      Please help :`(
        • 1. Re: How to crop image?
          It appears as though the image is stored as a BLOB and you are trying to create an ORDImage object just to use the processCopy() method.

          Alternatively, you can use processCopy() with the BLOB without creating an ORDImage object. Several of the ORDImage methods are supported for BLOBs and they are documented here: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10776/ch_relatref.htm#g1116554 . Both process() and processCopy() for BLOBs are documented here. It includes a complete example for format conversion using process() and processCopy() and you can change it to do cropping.