Solved

Oracle convert GIF BLOB to JPG BLOB

Posted on 2014-02-13
7
2,893 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 101

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
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!

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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 video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

729 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