Forum Stats

  • 3,837,271 Users
  • 2,262,245 Discussions
  • 7,900,244 Comments

Discussions

Display an image using oracle forms

User_1FFFH
User_1FFFH Member Posts: 6 Red Ribbon

I have an image file created in paint3d and saved as a TIFF file. I've created an image item in forms to display the file but when the image renders in the application it appears a bit out of focus and not clear. In the functional properties I have set:

image format =TIFF

image depth = original

display quality = high

sizing style = adjust

the width = 140 and height is 61

Is there a way to improve the quality of the image as it appears in the application?

This is a forms 12.2.1.2 application

Best Answer

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,295 Employee

    There are several things to do in order to improve image quality, however some would require that you upgrade to 12.2.1.4.

    o Ensure that the image object size is the same ratio as the image you are loading into it.

    o If possible, ensure that the image object size is the same size as the image you are loading into it.

    o Set the Image Format to Native (new in v12). Note that this will generally only add value in cases where the image was originally loaded while this was set. If an image was inserted into the DB prior to making this change, its display quality may still be somewhat soft. Also note that by using "Native" you are telling Forms to deliver the entire image to the client for display. This means that if you have a 10M image stored in the DB, the entire 10M will be sent to the client, which could degrade performance especially if more than one image is loaded/displayed at the same time.

    o Do not use TIFF. Instead use uncompressed JPG or GIF. This is especially true if using "Native". You can also use PNG when setting the format to "Native"

    o Some subtle improvements to image handling were introduced in each dot release of v12. Therefore, moving to 12.2.1.4 may be the best first step.


    More information about new features to v12 can be found in the Forms New Features guide.

    https://www.oracle.com/a/tech/docs/oracleforms-1221-newfeatures.pdf


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,295 Employee

    There are several things to do in order to improve image quality, however some would require that you upgrade to 12.2.1.4.

    o Ensure that the image object size is the same ratio as the image you are loading into it.

    o If possible, ensure that the image object size is the same size as the image you are loading into it.

    o Set the Image Format to Native (new in v12). Note that this will generally only add value in cases where the image was originally loaded while this was set. If an image was inserted into the DB prior to making this change, its display quality may still be somewhat soft. Also note that by using "Native" you are telling Forms to deliver the entire image to the client for display. This means that if you have a 10M image stored in the DB, the entire 10M will be sent to the client, which could degrade performance especially if more than one image is loaded/displayed at the same time.

    o Do not use TIFF. Instead use uncompressed JPG or GIF. This is especially true if using "Native". You can also use PNG when setting the format to "Native"

    o Some subtle improvements to image handling were introduced in each dot release of v12. Therefore, moving to 12.2.1.4 may be the best first step.


    More information about new features to v12 can be found in the Forms New Features guide.

    https://www.oracle.com/a/tech/docs/oracleforms-1221-newfeatures.pdf


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • User_1FFFH
    User_1FFFH Member Posts: 6 Red Ribbon

    The native option for image format doesn't appear to be available in 12.2.1.2. Must be in one of the later 12 releases. If I use jpg and native is not available, will it work with one of the other formats?

    These are the only choices:


  • Jaber
    Jaber Member Posts: 3 Blue Ribbon

    Hi Michael,

    Thanks for the information,

    I have changed the image format to "native" and now it's not showing the the existing images (Images are saved in database), instead its shows iconic image, if I change to TIFF or BMP or GIF it's showing correct image, the previous image format was TIFF

    current forms version 12.2.1.4

    Database 12c (Image data type blob)

    Jaber

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,295 Employee
    edited Jul 25, 2022 1:40PM

    I will investigate this further for you. It is possible I mis-spoke in that, "Native" may only support web image formats like gif, jpg, png. I will update this thread when I have more information.

    Edited:

    So I have confirmed that only PNG, JPG, and GIF currently support the "Native" format option. I will discuss this limitation with Development and see if we can enhance this functionality to support TIFF in a future release.

    I apologize for creating any confusion. More information can be found in the Builder Help. Here is a snippet of that text.



    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • Jaber
    Jaber Member Posts: 3 Blue Ribbon

    Thank you Michael for quick update

    Well, Is there any way I can convert the existing images (it's 10000+) to be compatible to use with "Native" image format, now a days users wants to upload images taken by the smart phone.

    Appreciate your help


    Jaber

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,295 Employee

    Mobile devices (any platform) all support at least one standard format like JPG and a possible a format like HEIC/HEIF (High Efficiency Image File Format). JPG is already a supported Forms format. So if users want to use mobile images they should be instructed to use JPG. In your code, you can check the file name/extension to somewhat confirm they are doing the right thing. If not, you can catch this and throw a message.

    If you want to allow users to upload any format, you can use WebUtil to upload the image to the middle-tier. Then on the mid-tier use a command line image editing utility (using the Forms HOST command) to convert the format to whatever you want. Then use READ_IMAGE_FILE to upload to DB (from mid-tier). Here is one example of a command line compatible imaging tool. Note that I am not endorsing it nor am I familiar with it. I just did a quick Internet search for command line image editing tools.

    https://imagemagick.org/index.php


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

    Jaber
  • Jaber
    Jaber Member Posts: 3 Blue Ribbon

    If someone wants to change the existing images to be able to view with image format type "Native"

    tested on forms version 12.2.1.4 and DB version 12c

    • If you have long raw data type you have to change to blob by following command

    alter table img_tbl  

    modify (img_itm blob);

    • rebuild the index (Once you change the data type from 'LONG RAW' to 'BLOB' the index will be invalid) :

    alter index <Index_Name> rebuild online;

    • convert the existing image by using ORDSYS.ORDIMAGE package

    declare

      cursor c1 is

      select PK_ID from img_tbl

      where dbms_lob.getlength(img_itm) > 0;

      source_image blob;

      dest_image blob;

    begin

       for x in c1 loop

      select img_itm into source_image from img_tbl where PK_ID =x.PK_ID;

      select img_itm into dest_image from img_tbl where PK_ID =x.PK_ID for update;

      -- convert source image to JPEG

      ordsys.ordimage.processcopy(source_image, 'fileformat=jpeg', dest_image);

      update img_tbl

      set img_itm=dest_image   

      where PK_ID =x.PK_ID;

      commit;

    end loop;

    end;

    you can add mime type (if needed) 'image/jpeg'

    • Open form builder and change the image item's "image format" to Native
    • If you have converted the data type from long raw to blob then go to block level property "Database -> Query Data Source Columns" click on "More...", select the image item and change type to BLOB
    • Compile the form

    We have tested on forms and Apex

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,295 Employee

    For anyone interested in using the new (12.2.1.4) Forms "native" image property value, but would prefer to not change and regenerate your modules, special environment variables have been created to accomplish this. Simply set the variable(s) and all image items previously using format JPG or GIF will use "native". Details can be found in the Forms documentation.

    https://docs.oracle.com/en/middleware/developer-tools/forms/12.2.1.4/working-forms/environment-variables.html

    On the page, search for these: FORMS_MAP_GIF_IMAGE_TO_NATIVEor FORMS_MAP_JFIF_IMAGE_TO_NATIVE


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM