Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Oracle convert GIF BLOB to JPG BLOB

Posted on 2014-02-13
7
Medium Priority
?
3,203 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

604 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