Solved

Oracle convert GIF BLOB to JPG BLOB

Posted on 2014-02-13
7
2,475 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 73

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 142

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 142

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now