5 Replies Latest reply: May 7, 2012 2:12 AM by 674189 RSS

    Changing data_content via read/write_image_file?

    user13119119
      Hallo,
      I use Forms 11G R2.

      I store images in the database via
      CLIENT_IMAGE.READ_IMAGE_FILE(vFile,'ANY','SD_DOCUMENT.DOCUMENT'); -- SD_DOCUMENT.DOCUMENT= Lob-Column

      To show up the stored image I use
      CLIENT_IMAGE.WRITE_IMAGE_FILE(vFile_Path, vTyp,'SD_DOCUMENT.DOCUMENT', NO_COMPRESSION, original_depth);
      and
      CLIENT_HOST ('eog ' || vFile_Path, NO_SCREEN); ( on Linux-Client)

      This works for Tif-Files. By importing JPG the image-files will be transformed to tiff and the viewer isn't able to show it, because the name is stored with jpg.

      Now, I don't know where the transformation take place: by importing, or in the databse lob-column or when reading the image.

      What must I change to get a jpg-image stored and read as jpg?

      thanks in advance.
      best regards
      Eveline Merches
        • 1. Re: Changing data_content via read/write_image_file?
          InoL
          CLIENT_IMAGE.WRITE_IMAGE_FILE(vFile_Path, vTyp,'SD_DOCUMENT.DOCUMENT', NO_COMPRESSION, original_depth);
          What is the value of vTyp?
          According to the Help these are valid values:
          The file type of the image: BMP, CALS, GIF, JFIF, JPEG, PICT, RAS, TIFF, or TPIC.
          So, try to use JPEG in case you used JPG.

          Oh, and also try to specify the file type explicitly when reading the file. There is a mismatch for JPG, though, in the 10g documentation (I don't have 11g):
          The valid image file type: BMP, CALS, GIF, JFIF, JPG, PICT, RAS, TIFF, or TPIC. (Note: File type is optional, as Oracle Forms will attempt to deduce it from the source image file. To optimize performance, however, you should specify the file type.)

          Edited by: InoL on May 3, 2012 9:22 AM
          • 2. Re: Changing data_content via read/write_image_file?
            user13119119
            Hi Inol,
            thank you for reply.
            I take the file-extension for filtetype. I try to change jpg to jpeg explicitly in my function.
            I am comming back to tell wether it works.

            best regards
            Eveline Merches
            • 3. Re: Changing data_content via read/write_image_file?
              user13119119
              Hi,
              I tried and I have no luck.
              The image-field in the forms cannot have the JPG-Filetyp-property. It is missing in the list of values.
              So my form transformed all images to tiff, regardless of which type the image is.
              Perhaps when storing the image in the database transformation take place too.

              Eveline Merches
              • 4. Re: Changing data_content via read/write_image_file?
                InoL
                Maybe the conversion happens here:
                CLIENT_IMAGE.WRITE_IMAGE_FILE(vFile_Path, vTyp,'SD_DOCUMENT.DOCUMENT', NO_COMPRESSION, original_depth);

                Not sure, but the NO_COMPRESSION may uncompress the JPG (which would be the same as a TIFF). If you leave it out (it's optional), the original compression is probably used.

                You can open the image file in an ASCII editor and check the header . It will show JFIF for a JPG file and II for a TIFF file.
                • 5. Re: Changing data_content via read/write_image_file?
                  674189
                  Hello Inol,
                  thanks a lot.
                  I tried, but the image remained being a jpg-file.
                  In Forms 6i it is the same. I think it is caused by the property of the image-field. I choose tif. In the help-file can be read that the files will be stored with their given format. Only if the format is not recognized then it will be stored as a tif. So jpg is not recognized? Bmp-file in the same image-field for example is recognized and exported as bmp.
                  I cannot choose jpg to test whether this option is the problem, because jpg is missing in the list (also in forms 11G).
                  My solution is now to change the file-ending to tif, when exporting a stored jpg-picture. That works for now.

                  best regards
                  Eveline Merches