Extracting Single Images from Multi-Page TIFF Image Results in Big Size for Destination Images in Oracle 9.2

(Doc ID 460637.1)

Last updated on FEBRUARY 08, 2017

Applies to:

Oracle Multimedia - Version: 9.2.0.1 to 9.2.0.8 - Release: 9.2 to 9.2
Information in this document applies to any platform.

Symptoms

When splitting a multi-tiff file into multiple tiff images and storing each image into the same table in different records, the result is that each image takes a lot of database capacity.

Steps to verify this problem

Load the multi-tiff file

connect / as sysdba
-- Create the directory that points to the physical path were the multi-tiff
-- image is placed.
create or replace directory imagedir as 'D:\TEMP';
grant read on directory imagedir to scott;

connect scott/tiger
-- Create the table that stores the multi-tiff file and the result of the
-- image-splitting.
drop table IMAGE_TABLE;
create table image_table (id number primary key, image ordsys.ordimage);

-- Create the procedure to be used to load the multi-tiff file
create or replace procedure image_import(dest_id number, filename varchar2) is
img ordsys.ordimage;
ctx raw(64) := null;
begin
delete from image_table where id = dest_id;
insert into image_table (id, image)
values (dest_id, ordsys.ordimage.init())
returning image into img;
img.importFrom(ctx, 'file', 'IMAGEDIR', filename);
update image_table set image=img where id=dest_id;
end;
/

-- Create the procedure to be used to split the multi-tiff image.
create or replace procedure image_processCopy(source_id number, dest_id number, verb varchar2)
is
imgSrc ordsys.ordimage;
imgDst ordsys.ordimage;
begin
delete from image_table where id = dest_id;
insert into image_table (id, image)
values (dest_id, ordsys.ordimage.init());
select image into imgSrc from image_table where id = source_id;
select image into imgDst from image_table where id = dest_id for update;
imgSrc.processCopy(verb, imgDst);
update image_table set image = imgDst where id = dest_id;
end;
/

-- Load the mutli-tiff file.
call image_import(1,'my_mt_image.TIF');

Split the multi-tiff file by using processcopy.

call image_processcopy(1,3,'page=0 FILEFORMAT=TIFF');
call image_processcopy(1,4,'page=1 FILEFORMAT=TIFF');
call image_processcopy(1,5,'page=0');
call image_processcopy(1,6,'page=1');
commit;

Verify the problem

col LENGTH FORMAT 999999999999
col FILEFORMAT FORMAT A20
col ID FORMAT 999
select ID, a.IMAGE.GETCONTENTLENGTH() AS LENGTH ,
         a.image.getfileformat() AS FILEFORMAT
FROM IMAGE_TABLE a;


Results:

In 9.2.0.8:

ID   LENGTH      FILEFORMAT
---- -------------  --------------------
1     82368           TIFF
3     1123560       TIFF
4     1113328       TIFF
5     55412           TIFF
6     26967           TIFF

where :
id=1 is the original image
id=3 -> page=0 fileformat=tiff
id=4 -> page=1 fileformat=tiff

Interesting are rows :
id=5 -> page=0
id=6 -> page=1

These two rows appear to be the result of a correct split of the multi-tiff image corresponding to
id=1.

In 10.2.0.3

ID    LENGTH     FILEFORMAT
----  -------------    --------------------
1      82368          TIFF
3      49742          TIFF
4      26942          TIFF
5      55412          TIFF
6      26967          TIFF

In 10gR2 the problem does not occur.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms