“Before you start criticizing my question, how about helping me instead?”
I’m working with a C# application where I need to view images stored in a SQL SERVER database column of type IMAGE
from a legacy database [not possible to change]. However, the data in this column seems to be compressed using BLOBZIP
[I know because you can see when open SQL image Viewer, and I’m encountering issues while trying to read and display the images.
I have tried various libraries and methods to decompress and preview this data, including: SharpZipLib, SharpCompress and BZip2Sharp, but I keep running into errors.
** Additional information:
-
It is an image (this is a Legacy database and it is possible to view the image via “SQL Image Viewer” software)
-
Some errors:
System.ArgumentException: ‘Parameter is not valid.’
System.FormatException: ‘Additional non-parsable characters are at the end of the string. -
I tried Gzipstream
-
I saw the “Magic number” and it is not “504B 0304”
-
It is “BLOBZIP” as I was able to see via “SQL Image Viewer software”
-
Example for a field [visible via SQL Image Viewer software]
0x424C4F425A495000140000004702000001000000789C55525B4FC230186D5C2228372F81C4B7EF07485011E1B5DBCAA86C2D6987806F041643228C6C4BF071FF1C3F1C33F0D4E63BA7E7D276BFBF205562B9AB3899CBED62156E82F89610B2DF1352205636AA3EF5802A0FE4C8E752E8A24EE69BE53C5A1AE92D229674E558E5E09590C74986324731AD4F51F61505719CA1032A6C97E5682D178601AEDF8191D69183E77DC52D5FFE7B545045057112AD1649181969CD447CE8C9B16B039BFABA747099FAB06B999E91364E5041B9CB85037D2EAE450856B85E079BC4488B48678A4B758F53F69304D12A8C406E136C8F512F1DBB0F92563BD06DF570D344838374C971299613D267BA8027459860E8024E3FD1A564AB191CF7465A1D50654FA86219BD78A4A37AD995D630EF56D6C8C62B19492E7C23BD3B389DB77B78830EA6B0A07B4CF3D886E7D62BECF03D6E46145570064D78A79EA9EB7FA43C71F3E5C09C30247E703173C16CE5AF5A393342E30917B69CE813AD46F7AC7EB39D89E16F21BFED6B9D7E
- These bytes do not match the ZIP file signature (504B 0304). However, the sequence 78 9C appearing later in the string suggests it might be zlib compressed data, which often begins with these bytes. I also run SharpZipLib that does not identity any other information.
The issue seems to be similar to the problem discussed here, but that question does not address the scenario where the data is compressed and, obviously, I came here after a long search.
Has anyone successfully handled the decompression of image data stored in an IMAGE
column that has been compressed with BLOBZIP
? If so, could you please share the approach or code examples that worked for you?