Solved

Oracle convert GIF BLOB to JPG BLOB

Posted on 2014-02-13
7
2,765 Views
Last Modified: 2014-02-17
Oracle 11g release 11.2.0.3

Crystal reports 2011   version 14.0.7.738 RTM

I have a product database that stores GIF images in a BLOB column. Crystal Report does not support GIF images.  I can display JPG BLOB images from an oracle database in Crystal Reports without any problems.  Using only oracle SQL or PL/SQL  how do I convert a GIF BLOG to a JPG BLOB.  

I have search the internet and believe that it can be done, but there is no clear example of how to do it.

Thank you for your help
Paul
0
Comment
Question by:fpkeegan
7 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 39857003
while it is probably possible to convert using nothing but pl/sql, it might be easier to create a java stored procedure with a pl/sql interface.

there are already available java classes for doing that


if you really want to do it with just pl/sql, that sounds like an interesting project.  Probably more than you're going to get in a Q&A forum
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39857144
I concur with above  
Likely the oracle intermedia stuff is what you are looking for
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39857183
How does the image get loaded/stored in the database?

If you have an application that does it, can you change the application to use one of the many freeware image conversion programs and then store the image to the database?

mlmcc
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:fpkeegan
ID: 39857288
As stated, the data is loaded from a product applacation, so it can not be changed.   Java development is not supported by the Company I work for,  so no Java.

I think it can be done with ORDSYS.ORDImage  or but I not sure how.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 39858432
I don't know for sure, but referring to the documentation, I would say that using the PROCESS method should be the key information here:
http://docs.oracle.com/cd/A87860_01/doc/inter.817/a85336/mm_imgre.htm

Examples

Example 1: Change the file format of image1 to GIF:

image1.process('fileFormat=GIFF');

Example 2: Change image1 to use lower quality JPEG compression and double the length of the image along the X-axis:

image1.process('compressionFormat=JPEG, compressionQuality=MAXCOMPRATIO, 
xScale="2.0"'); 

Note that changing the length on only one axis (for example, xScale=2.0) does not affect the length on the other axis, and would result in image distortion. Also, only the xScale and yScale parameters can be combined in a single operation. Any other combinations of scale operators result in an error.

The maxScale and fixedScale operators are especially useful for creating thumbnail images from various-sized originals. The following line creates at most a 32-by-32 pixel thumbnail image, preserving the original aspect ratio:

image1.process('maxScale=32 32');

Example 3: Convert the image to TIFF:

DECLARE
    Image ORDSYS.ORDImage;
BEGIN
    SELECT photo INTO Image FROM emp
        WHERE ename = 'John Doe' FOR UPDATE;
        Image.process('fileFormat=TIFF');
    UPDATE emp SET photo = Image WHERE ename = 'John Doe';
END;
/

Open in new window

0
 

Author Comment

by:fpkeegan
ID: 39864970
function convert_JPG (GIF_IMAGE in BLOB)
    return blob
 as
 -- convert the input gif IMAGE type to JPG  
   image ORDSYS.ORDImage;
   l_JPG_IMAGE  BLOB := empty_Blob();

 BEGIN
     
     
    dbms_lob.createTemporary(l_JPG_IMAGE ,false);
       
    image := ORDSYS.ORDImage(GIF_IMAGE,1);
     
    ordsys.ordimage.processCopy(GIF_IMAGE, 'fileformat=jpeg', l_JPG_IMAGE);
   
 
   return  l_JPG_IMAGE;
 End ;
0
 

Author Closing Comment

by:fpkeegan
ID: 39864973
good job...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
clob to char in oracle 3 88
Create file system directory from Oracle 10g 4 30
add more rows to hierarchy 3 33
Oracle cursor lifecycle inside procedure. 2 24
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question