Solved Centura Image (JPEG) format

Discussion forum about all things Gupta, OpenText and the community.
tuanpm
Vietnam
Posts: 4
Joined: 28 Dec 2020, 14:36
Location: Viet Nam

Centura Image (JPEG) format

Post by tuanpm » 28 Dec 2020, 15:45

Hello everyone,

We used an application written by Centura stores images (JPEG) in Oracle 11g database with LONG RAW data type. There should be no problem displaying this image is still the same application. However, now we need to export these images for viewing in another program and realize that the stored format is not standard. It consists of a header in Centura:JPEG

At the moment we cannot find any documentation on this archive format to convert our images to original format. We greatly appreciate if anyone knew any tool, code, or documentation that could help us.

Thank you
2020-12-28 at 22.png
You do not have the required permissions to view the files attached to this post.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3522
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Centura Image (JPEG) format

Post by Dave Rabelink » 28 Dec 2020, 21:08

Looking at the header of the data (stored in Oracle), it seems to be compressed data using SalStrCompress.

You need to extract the data from Oracle and uncompress it using SalStrUncompress before using it in an external viewer.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

minhngvan
Afghanistan
Posts: 8
Joined: 28 Dec 2020, 15:16
Location: Afghanistan

Re: Centura Image (JPEG) format

Post by minhngvan » 29 Dec 2020, 04:05

Hi Dave,
Where can I download a trial version of TD IDE, so I can test `SalStrUncompress` and `SalStrCompress` functions?

Thanks

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3522
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Centura Image (JPEG) format

Post by Dave Rabelink » 29 Dec 2020, 08:24

minhngvan wrote:
29 Dec 2020, 04:05
Where can I download a trial version of TD IDE

https://www.opentext.com/products-and-s ... -developer
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

tuanpm
Vietnam
Posts: 4
Joined: 28 Dec 2020, 14:36
Location: Viet Nam

Re: Centura Image (JPEG) format

Post by tuanpm » 29 Dec 2020, 09:36

Dave Rabelink wrote:
28 Dec 2020, 21:08
Looking at the header of the data (stored in Oracle), it seems to be compressed data using SalStrCompress.

You need to extract the data from Oracle and uncompress it using SalStrUncompress before using it in an external viewer.
Do you have any documents about compression algorithm used by SalStrCompress? Or any .exe program that input is compressed file, output is uncompressed file?

Thank you very much

minhngvan
Afghanistan
Posts: 8
Joined: 28 Dec 2020, 15:16
Location: Afghanistan

Re: Centura Image (JPEG) format

Post by minhngvan » 29 Dec 2020, 09:37

Hi Dave,
We registered for trial but not received email for download link.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3522
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Centura Image (JPEG) format

Post by Dave Rabelink » 29 Dec 2020, 10:26

minhngvan wrote:
29 Dec 2020, 09:37
We registered for trial but not received email for download link.
I did not download a trial before so I'm not sure how long it takes to get the email.
It could take a while maybe.

tuanpm wrote:
29 Dec 2020, 09:36
Do you have any documents about compression algorithm used by SalStrCompress? Or any .exe program that input is compressed file, output is uncompressed file?
No. I do not know what algorithm Sal compression is using. But I'm quite confident it is a TD proprietary format.

Which TD version is used for the application right now which is saving/reading the images from the database?
It seems you do not have the source for that application and you are not a TD developer?
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

tuanpm
Vietnam
Posts: 4
Joined: 28 Dec 2020, 14:36
Location: Viet Nam

Re: Centura Image (JPEG) format

Post by tuanpm » 29 Dec 2020, 13:28

Which TD version is used for the application right now which is saving/reading the images from the database?
It seems you do not have the source for that application and you are not a TD developer?
We use a Centura 5 application developed by other developer without any source code. Their company was dissolved and now we need to switch to other software. However, it was necessary to convert some old data and we had this problem.

And yes, I'm not TD Developer, but I'll know a bit if I can download TD IDE trial and try uncompress this file. I also register to email but have not received any links, including in the spam folder.

Thanks.,

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3522
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Centura Image (JPEG) format

Post by Dave Rabelink » 05 Jan 2021, 08:55

To follow up on this.

I have found an article in an old issue of CenturaPro.
See page 11 - Get That Picture Back

CenturaPro - 1998-05.pdf


So the TD application got the jpeg image from a TD picture object, then compressed it and saved it to the database.
To get the original jpeg back, you need first to uncompress the data and then use the "strip off Centura header" as explained in the article.

The uncompress step is probably not needed. The SalStrCompress functionality will not compress data which can not be compressed any further.
Looking at the screenshot in the start post, the image in the database contains the original data.

You can check if the data is original by looking at the 4th byte.
When byte[3] = 0x2, the data is compressed.
When byte[3] = 0x0, the data is original.

As can be seen, the jpeg data in the database has byte[3] = 0x0, so the data is original.

What you can do in this case:

- Get the data from the database and strip of all bytes up to byte[14]. The first 15 bytes is the SAL compression header.
- Strip of the "Centura:jpeg" header. I think the function explained in article just removed the "Centura:jpeg" plus one null byte.
- Save the resulting data to file which will be the original jpeg file.

If the compressionheader byte[3] = 0x2, you need to uncompress the data first.
But I guess all jpeg images will be stored having the original data as the SAL compression is unable to compress jpeg compression any further.
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3522
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: Centura Image (JPEG) format

Post by Dave Rabelink » 05 Jan 2021, 12:49

If you need to uncompress, here a solution in .NET:


viewtopic.php?f=27&t=73263
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

tuanpm
Vietnam
Posts: 4
Joined: 28 Dec 2020, 14:36
Location: Viet Nam

Re: Centura Image (JPEG) format

Post by tuanpm » 07 Jan 2021, 16:51

Dave Rabelink wrote:
05 Jan 2021, 08:55
To follow up on this.

I have found an article in an old issue of CenturaPro.
See page 11 - Get That Picture Back


CenturaPro - 1998-05.pdf



So the TD application got the jpeg image from a TD picture object, then compressed it and saved it to the database.
To get the original jpeg back, you need first to uncompress the data and then use the "strip off Centura header" as explained in the article.

The uncompress step is probably not needed. The SalStrCompress functionality will not compress data which can not be compressed any further.
Looking at the screenshot in the start post, the image in the database contains the original data.

You can check if the data is original by looking at the 4th byte.
When byte[3] = 0x2, the data is compressed.
When byte[3] = 0x0, the data is original.

As can be seen, the jpeg data in the database has byte[3] = 0x0, so the data is original.

What you can do in this case:

- Get the data from the database and strip of all bytes up to byte[14]. The first 15 bytes is the SAL compression header.
- Strip of the "Centura:jpeg" header. I think the function explained in article just removed the "Centura:jpeg" plus one null byte.
- Save the resulting data to file which will be the original jpeg file.

If the compressionheader byte[3] = 0x2, you need to uncompress the data first.
But I guess all jpeg images will be stored having the original data as the SAL compression is unable to compress jpeg compression any further.
I tried this and it worked, the .net library for compressed data also worked too. I really appreciate your time to explain things. Thank you so much

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest