Jmsrickland,
I want to take this hex code and compress it so that the file size is smaller.
Thanks.
Printable View
Then I suggest you try using LZW compression. If you need help on that I might be able to help you.
I have a question however.
Is the code you posted in post #39 the actual hex data you want to compress or is it just a hex dump of the actual data? It's makes a big difference so I need to know which one it is.
EDIT:
Never mind. I tried using your hex code after I converted it to real hex (not a hex dump) and it turned out that the LZW compression actually made the compressed data larger than the original data. That is one of the problems of LZW compression. I can't explain it but it does happen from time to time depending on the input data.
I see that your hex code dump is that of a JPEG image file
I used ZIP logic on it and it compressed it down to 46% of the original. I believe that will be a good choice to use.
Jmsrickland,
Thanks a lot, i really appreciate.
The hex code dump is for a jpeg image file.
Please, below is the beginning of the actual hex value of the image file i want to convert. I would have pasted all for you to see but the character are more than 15000 that the message can take but below is the beginning of the hex code.
Thanks.
FFD8FFE000104A46494600010101006000600000FFDB00430006040506050406060506070706080A100A0A09090A140E0F0C 1017141818171416161A1D251F1A1B231C1616202C20232627292A29191F2D302D283025282928FFDB0043010707070A080A 130A0A13281A161A282828282828282828282828282828282828282828282828282828282828282828282828282828282828 2828282828282828FFC0001108028001E003012200021101031101FFC4001D00000105010101010000000000000000000300 0102040506070809FFC4003E1000010401030205020501080104010500010002031121040531124106132251610771142332 8191421533435272A1B1C108162462D1821773A2B2E1FFC400190101010101010100000000000000000000000102030405FF C4002D1101010002020201020502070100000000000102112131031241135122326171910452144281A1C1D1F0B1FFDA000C 03010002110311003F00FA680A28AD433FAD11A2B85DAB13EE41B9488BC24CFD44A939655168A52EF69AACD2937850301949 BCA4D49C2915271F4D52590A2EE29485D5207038F753AB75A80394459A18F36A49B914903541453A49248124924812492481 2492481249248124924812492481249584AC7BA0492498B80EE81D250648D7707F95340944D037DCA92670B081D23C243849 02492490249249024924902492490249249024924902492490249249024924902492490249249053AECA5DD21F29EB2BAB9C 3341B29DA924DE546CF594B1C27C7B26EEA225C25C849240BB25EC9352722A645D10329EE867951667299C338595139480CA 8379AECA7C281D24DC84E81249248124924823CA59507C8D8C5BDC00F92B9CDF7C67B46CD139FAAD4B057CDADE1E3CB2FCB1 CF2F2E38775D1807B809DEF6B05B9C00F95E15BBFD79D1F9B241B46946A9FC02496E7F85C9EE1E3BF186F2C7BDB29D069EAF D32C6FFF00657E94C6FE2BFF002E7F5ADFCB8FFC3E959F74D1C1FDE6A631FF00E4163EE1E36D936F07F13ABAAF617FF0BE53 66E916B35D7BFEF8F7C6D3798BBFEC55F93C47E08D1B45EDFA7DC1E0DF53A69987FF00ECB5AC3FCB2DFF00663EA65F3949FE EF6EDDBEB3EC5A469F21EF93DAE278FF00A5CCCDF5EB43D44F954CF7361791EF7F51F6A30866D5B38D2BC7F5C53B9FFF002B CF378DFB51B8CCF73C9A3D8A7D4F4FF2CFFEB3AB975957D4D0FD78D97A7F32568F7BB57A1FAD5E1A7C7D67712C79EC22715F 1AF9A4F74ED908FEA29FE270FED3E9E7FDCFB07FFD73D884C00D53E467CC642BDA2FAD1B0CF306BE73183FFC4AF8C04A41BB 28AC965E7A8FF29FE230FED278F3FEE7DFBB1F89B6ADEC7568F54C279F57A17430EA9A1DD121FB1E42FCF1DAB79D76D9A813 69350F648382492BDC3E9EFD68D4911E877F1E747802691D55FB049978FC9D70E93C994FCCFAA98E0E160A92E0BC2FE32DBF 592F4C1AA124478270BB13A8639A1C1C08F82B1978ECAED8E732E9681ABB2934F50B599A999CE748D69E5AB434C7F2583E14 B8E9B152492590924924092492409249240924924092492409249240924924092492409249240924924149BC1E13DA8BA81C 0526572BB33F29A49A827C28A569FBA6C24B227DB09289BE9095D8409DD94DD91F2A0A54824D3FEE9E8670A208BC27BA2A29 0BEA53B00F2A0E52C136A092499A9281F84AD44ACDDD777D36DB03E5D54AC8E368C925598DCAEA339E5309BABEF786B6DF40 7CAE13C77F52368F0A4044F331F3F6603CFF000BC87EA9FD6B7BE59B43E1D98D0B0651FF00D2F9F775DDB53B8EA5F36B667C 921366CAED71C3C5F9F9BF679AF933F2FE5E23D77C57F5B774DD24922D138C711C0A2BCE371DD9DACD409F71D43E67F3D249 0B9974E6A9B8427389EEB9793FA9CB29ABC4FD0C7C5272E9E2F143F4608DB9BE57EF7FF2B2F59BCEB35966694D9F6C2CC6A4 B94CECEB86EE32F62BE571FEA3FCA8BA43EE86F750C21DF5159F65D1DC4A768EE54805171536D749289F6437153885E4A8C8 B54A4D2542ED3B0E568586FF00FC95ED2C67FCD4B3D84728D0CA49A07091A759E14DDE6DAF78D3B84EFF002BAA9C2FB2FAAF C0DBBC3BA6DC5F04FD7D1C8F85F179D418806B3F59EEBD13E9078DA4D8F78669B5121304AEA36BB78F3F8A938AFADF6E94C9 D6E7E0F016D6964B0173BB7EAE1976DD3EB2120C721E6D6EC40C7107332174B1DE6AF4BE4802CA66BC388A4074A0E989EF4A 7A515102792B9E81D249251092492409249240924924092492409249240924924092492409249240924924140BACA90F72A1 91C84BB2EECA66FCCC2221385106B0A5FBAC89F2970981C2751526F09FFA428293B850338A56955A4E1541049BCA7BCA4CAB B49E32A04F363E13B47A547B0F64E1D9A4549954938F48B2A21F47E1701F547C7DA3F0A6DB21748D3A823D2DB5AC30B9DD47 3F279678E6EB5BC67E30D078736F9751AB9983A461B7CAF913EA4FD49DCFC4FAC91BF887B345C363FF00FD585E36F18EBFC4 DAE7CDAB94F45E1B7C2E4257FBAD793CB3C73D70FE5E698DF25F6CFF00816594B89249FE505D221D9714FD143E57932C9DE1 0B3CA9B545A7BF65219CAC29FE533CDA4E38F843CBBECAB27C14E46133AB84EEA51A3125A865D949CEB2A0DE5565268B4671 A14A2C01ADB51E4DF641369A53B4368CDA223495FA69134E7A72ABDD9A44BA1482C30F992DA4D90B751D4C34421093A59F29 A22495B65F4AFD0DF167F6A6906CFAF9C07B28C77DD7D03A3D40818219DE2B8057C0BE1EDDF51B46BE3D4E9642C7C66D77DA CFAC9BDEA0006790015DFBAF4F8EE3973954FA971E247D850B84B601C2D1847485F287853EBAEB746591EE30F9CC1DE49280 FE17B1F83BEAEEC5BE9F2DF388E73FD20123F95ACB0F69BC6EDA9FD463D5E1E9E1CA4A968F5FA6D5B7AA0958F1F055C041E0 AE3659DBAEE5E8E924928A49249204924920492492049249204924920492492049249204924920CFB354A608E8F8506A7B1D 34395DD8952C1C653B80039516A7C1FBA8D2756329D3348EC13AC849D324A076F2A472A359E6948F00A08819533DF2A1DF29 904BB7CA8385BAFBA21385C6FD45F19E8FC25B2C9A89DE3CD386B7B92AE38DCAEA319F9278E6E83F50FC65A5F0AED72CF24E 3CEAF4B6D7C61E36F156B7C49BB4BAAD5CA5F64D0BE023F8F3C61ADF146E926A754F3D17E917C05C7BE45AF2792633D7079B 1973BED91DEEE7280E3693885268C595E2763B062D3A8B9FD827AB3F0A2ECFCFD9488C2448010DEEEA550B9E11380A0DC053 B1FBA08A138953964EC860E10454981337953EC8138F652E070A0D22D4C7BD20976A4AFDD3757C26C75851AD883DD2B4AE94 715840D65C6BB2B30E052AECAA5363A9D4B6CACDFAFEE12ABC21F982ED4AEC13DD68105057743B8C9A478746F23EC550B694 BCAF45859997A9DBD7BC23F55751B3CB060BE318702EE7EEBDEBC37F54F61DD1911FC632295F831B5A4E7EE57C46F0E6D52B 1A6D64F09C3DE07C1A5E8C7CF3ACA6D8F5CA7E5AFD12DB776D36B30C9184F6CE56A0CAF873C09F5035DB3EAE2B9C8881EFD9 7D4DE09F173B7DD9DBAAD239BA937D07ADDD14AD98E7CE2EBE3F25BC65DBBFA4964E8F79D3EA25742496C8DE706BF95A8D70 70B69047C2C58E92ED2492494524924902492490249249024924902492490249249067D8072A5579B507D5A57F0BBA260F3E EA55594367EA6A9E38503B029528B4E4A566D4134937CA74093F35EC992590FC26490357A88F490BE699DD11B0592AC9B2D9 8CDD6778B37FD2F87B67D46BB58F0C646D247C95F167D4AF19EABC57BAC93EA253E4024471DE005D5FD74FA86FF116E8FD06 91D5B7C2EAC1E4F0578BCF2173F95BF2E7F4B1F59DFCFF00D3C737E4CBDAF5F0691D64D7080F207DD4DE6820F4D9B5E37649 8DBC909DC1275D5050CF0B22758C22B9BD2CCF2A318EE546692CAB201BB254D83BA8305BF28C028B215283CD29C87A505D9C 95616A3DF29C800A5C0505513676447015486CC654D82CD95911AEC14DA9AAD381C22C31C0054982C5A5CBE910800048A8A8 DF65177E8B724CCA32227EE95D04DD41684811C774D79E50BFA8A580729B1681005A2093182A9B5D43E14D8EFE105BEA05AA 382837D94AE8E105AD3DF5D0E4AEB7C13E36DC7C2BAB27492BC0272DB5C5B2522BA93B9C7AED5C73B85DC5B3DBB7D51B27D5 B8F71D0B0EFF00A33D04D35C1C4FFB00BB9D9FC6307A24D24E66D3102DB5418BE79FA59E31D9743B749B7F8820649193D609 27F8C2E8773DFF0061D8F57A7D66C
Jmsrickland,
Please i need your help in the compression.
Thanks a lot, i really appreciate.
The hex code dump is for a jpeg image file.
Please, below is the beginning of the actual hex value of the image file i want to convert. I would have pasted all for you to see but the character are more than 15000 that the message can take but below is the beginning of the hex code of the jpeg file.
Thanks.
FFD8FFE000104A46494600010101006000600000FFDB00430006040506050406060506070706080A100A0A09090A140E0F0C 1017141818171416161A1D251F1A1B231C1616202C20232627292A29191F2D302D283025282928FFDB0043010707070A080A 130A0A13281A161A282828282828282828282828282828282828282828282828282828282828282828282828282828282828 2828282828282828FFC0001108028001E003012200021101031101FFC4001D00000105010101010000000000000000000300 0102040506070809FFC4003E1000010401030205020501080104010500010002031121040531124106132251610771142332 8191421533435272A1B1C108162462D1821773A2B2E1FFC400190101010101010100000000000000000000000102030405FF C4002D1101010002020201020502070100000000000102112131031241135122326171910452144281A1C1D1F0B1FFDA000C 03010002110311003F00FA680A28AD433FAD11A2B85DAB13EE41B9488BC24CFD44A939655168A52EF69AACD2937850301949 BCA4D49C2915271F4D52590A2EE29485D5207038F753AB75A80394459A18F36A49B914903541453A49248124924812492481 2492481249248124924812492481249584AC7BA0492498B80EE81D250648D7707F95340944D037DCA92670B081D23C243849 02492490249249024924902492490249249024924902492490249249024924902492490249249053AECA5DD21F29EB2BAB9C 3341B29DA924DE546CF594B1C27C7B26EEA225C25C849240BB25EC9352722A645D10329EE867951667299C338595139480CA 8379AECA7C281D24DC84E81249248124924823CA59507C8D8C5BDC00F92B9CDF7C67B46CD139FAAD4B057CDADE1E3CB2FCB1 CF2F2E38775D1807B809DEF6B05B9C00F95E15BBFD79D1F9B241B46946A9FC02496E7F85C9EE1E3BF186F2C7BDB29D069EAF D32C6FFF00657E94C6FE2BFF002E7F5ADFCB8FFC3E959F74D1C1FDE6A631FF00E4163EE1E36D936F07F13ABAAF617FF0BE53 66E916B35D7BFEF8F7C6D3798BBFEC55F93C47E08D1B45EDFA7DC1E0DF53A69987FF00ECB5AC3FCB2DFF00663EA65F3949FE EF6EDDBEB3EC5A469F21EF93DAE278FF00A5CCCDF5EB43D44F954CF7361791EF7F51F6A30866D5B38D2BC7F5C53B9FFF002B CF378DFB51B8CCF73C9A3D8A7D4F4FF2CFFEB3AB975957D4D0FD78D97A7F32568F7BB57A1FAD5E1A7C7D67712C79EC22715F 1AF9A4F74ED908FEA29FE270FED3E9E7FDCFB07FFD73D884C00D53E467CC642BDA2FAD1B0CF306BE73183FFC4AF8C04A41BB 28AC965E7A8FF29FE230FED278F3FEE7DFBB1F89B6ADEC7568F54C279F57A17430EA9A1DD121FB1E42FCF1DAB79D76D9A813 69350F648382492BDC3E9EFD68D4911E877F1E747802691D55FB049978FC9D70E93C994FCCFAA98E0E160A92E0BC2FE32DBF 592F4C1AA124478270BB13A8639A1C1C08F82B1978ECAED8E732E9681ABB2934F50B599A999CE748D69E5AB434C7F2583E14 B8E9B152492590924924092492409249240924924092492409249240924924092492409249240924924149BC1E13DA8BA81C 0526572BB33F29A49A827C28A569FBA6C24B227DB09289BE9095D8409DD94DD91F2A0A54824D3FEE9E8670A208BC27BA2A29 0BEA53B00F2A0E52C136A092499A9281F84AD44ACDDD777D36DB03E5D54AC8E368C925598DCAEA339E5309BABEF786B6DF40 7CAE13C77F52368F0A4044F331F3F6603CFF000BC87EA9FD6B7BE59B43E1D98D0B0651FF00D2F9F775DDB53B8EA5F36B667C 921366CAED71C3C5F9F9BF679AF933F2FE5E23D77C57F5B774DD24922D138C711C0A2BCE371DD9DACD409F71D43E67F3D249 0B9974E6A9B8427389EEB9793FA9CB29ABC4FD0C7C5272E9E2F143F4608DB9BE57EF7FF2B2F59BCEB35966694D9F6C2CC6A4 B94CECEB86EE32F62BE571FEA3FCA8BA43EE86F750C21DF5159F65D1DC4A768EE54805171536D749289F6437153885E4A8C8 B54A4D2542ED3B0E568586FF00FC95ED2C67FCD4B3D84728D0CA49A07091A759E14DDE6DAF78D3B84EFF002BAA9C2FB2FAAF C0DBBC3BA6DC5F04FD7D1C8F85F179D418806B3F59EEBD13E9078DA4D8F78669B5121304AEA36BB78F3F8A938AFADF6E94C9 D6E7E0F016D6964B0173BB7EAE1976DD3EB2120C721E6D6EC40C7107332174B1DE6AF4BE4802CA66BC388A4074A0E989EF4A 7A515102792B9E81D249251092492409249240924924092492409249240924924092492409249240924924140BACA90F72A1 91C84BB2EECA66FCCC2221385106B0A5FBAC89F2970981C2751526F09FFA428293B850338A56955A4E1541049BCA7BCA4CAB B49E32A04F363E13B47A547B0F64E1D9A4549954938F48B2A21F47E1701F547C7DA3F0A6DB21748D3A823D2DB5AC30B9DD47 3F279678E6EB5BC67E30D078736F9751AB9983A461B7CAF913EA4FD49DCFC4FAC91BF887B345C363FF00FD585E36F18EBFC4 DAE7CDAB94F45E1B7C2E4257FBAD793CB3C73D70FE5E698DF25F6CFF00816594B89249FE505D221D9714FD143E57932C9DE1 0B3CA9B545A7BF65219CAC29FE533CDA4E38F843CBBECAB27C14E46133AB84EEA51A3125A865D949CEB2A0DE5565268B4671 A14A2C01ADB51E4DF641369A53B4368CDA223495FA69134E7A72ABDD9A44BA1482C30F992DA4D90B751D4C34421093A59F29 A22495B65F4AFD0DF167F6A6906CFAF9C07B28C77DD7D03A3D40818219DE2B8057C0BE1EDDF51B46BE3D4E9642C7C66D77DA CFAC9BDEA0006790015DFBAF4F8EE3973954FA971E247D850B84B601C2D1847485F287853EBAEB746591EE30F9CC1DE49280 FE17B1F83BEAEEC5BE9F2DF388E73FD20123F95ACB0F69BC6EDA9FD463D5E1E9E1CA4A968F5FA6D5B7AA0958F1F055C041E0 AE3659DBAEE5E8E924928A49249204924920492492049249204924920492492049249204924920CFB354A608E8F8506A7B1D 34395DD8952C1C653B80039516A7C1FBA8D2756329D3348EC13AC849D324A076F2A472A359E6948F00A08819533DF2A1DF29 904BB7CA8385BAFBA21385C6FD45F19E8FC25B2C9A89DE3CD386B7B92AE38DCAEA319F9278E6E83F50FC65A5F0AED72CF24E 3CEAF4B6D7C61E36F156B7C49BB4BAAD5CA5F64D0BE023F8F3C61ADF146E926A754F3D17E917C05C7BE45AF2792633D7079B 1973BED91DEEE7280E3693885268C595E2763B062D3A8B9FD827AB3F0A2ECFCFD9488C2448010DEEEA550B9E11380A0DC053 B1FBA08A138953964EC860E10454981337953EC8138F652E070A0D22D4C7BD20976A4AFDD3757C26C75851AD883DD2B4AE94 715840D65C6BB2B30E052AECAA5363A9D4B6CACDFAFEE12ABC21F982ED4AEC13DD68105057743B8C9A478746F23EC550B694 BCAF45859997A9DBD7BC23F55751B3CB060BE318702EE7EEBDEBC37F54F61DD1911FC632295F831B5A4E7EE57C46F0E6D52B 1A6D64F09C3DE07C1A5E8C7CF3ACA6D8F5CA7E5AFD12DB776D36B30C9184F6CE56A0CAF873C09F5035DB3EAE2B9C8881EFD9 7D4DE09F173B7DD9DBAAD239BA937D07ADDD14AD98E7CE2EBE3F25BC65DBBFA4964E8F79D3EA25742496C8DE706BF95A8D70 70B69047C2C58E92ED2492494524924902492490249249024924902492490249249067D8072A5579B507D5A57F0BBA260F3E EA55594367EA6A9E38503B029528B4E4A566D4134937CA74093F35EC992590FC26490357A88F490BE699DD11B0592AC9B2D9 8CDD6778B37FD2F87B67D46BB58F0C646D247C95F167D4AF19EABC57BAC93EA253E4024471DE005D5FD74FA86FF116E8FD06 91D5B7C2EAC1E4F0578BCF2173F95BF2E7F4B1F59DFCFF00D3C737E4CBDAF5F0691D64D7080F207DD4DE6820F4D9B5E37649 8DBC909DC1275D5050CF0B22758C22B9BD2CCF2A318EE546692CAB201BB254D83BA8305BF28C028B215283CD29C87A505D9C 95616A3DF29C800A5C0505513676447015486CC654D82CD95911AEC14DA9AAD381C22C31C0054982C5A5CBE910800048A8A8 DF65177E8B724CCA32227EE95D04DD41684811C774D79E50BFA8A580729B1681005A2093182A9B5D43E14D8EFE105BEA05AA 382837D94AE8E105AD3DF5D0E4AEB7C13E36DC7C2BAB27492BC0272DB5C5B2522BA93B9C7AED5C73B85DC5B3DBB7D51B27D5 B8F71D0B0EFF00A33D04D35C1C4FFB00BB9D9FC6307A24D24E66D3102DB5418BE79FA59E31D9743B749B7F8820649193D609 27F8C2E8773DFF0061D8F57A7D66C
Joacim,
Please, what I'm trying to say is, if there is any code in vb6 to be added which will reduce the number of hex string produced at initial stage. With that, it will not consume all the memory size with this hex string.
Please, i need your help on it.
Thanks.
Converting a compressed image (PNG, JPG, GIF) to a Hex string and then compress it, will not create a smaller file then the original file already is.Quote:
I want to take this hex code and compress it so that the file size is smaller.
As Arnoutdv says, a compressed file is compressed by looking for repetitive series of data that can be replaced with a shorter code that can be used to represent the longer pattern.
So once a file is compressed, the redundant data in the file has been pretty much squeezed out of it.
Trying to compress and already compressed file results in little to no extra compression, and often is actually slightly larger due to the overhead associated with the compression meta data added in the compression attempt.
If you uncompressed the data, then re-compressed it with a better compression algorithm, that would give you the best chance at a smaller file.
Converting a file to a hex string means the file will be twice the size of the original as a minimum (no formatting, just straight series of 2 digit hex values for each byte).
Since the hex values came from a compressed file, there will be very little repetitive data in the hex string to compress, and no way the hex string can be compressed to less than the size of the original file since it starts with the handicap of being twice the size of the original file before starting.
Anytime I see someone asking to convert a file to hex or binary, there is greater than 90% chance they have no idea of what they are talking about or what they want to do.
For those who do understand what a hex representation of binary data means, and it is what they need, then their need has already been covered years ago by this thread.
Solution to what?
I really don't have a clue what your question is or what you want to achieve.
maybe he's asking for a hash value? not sure though....
passel, do you need to convert the data back to an image or do you just want to compare two images to see if you 'already know this one' (like a captcha app would need to do). in any way you should try to explain your problem in more detail and with some background info like what you want to achieve with the whole program.
Don't ask me. I have no interest in it, actually.
i need to convert the image file into a (very short) hex string and not long hex string then convert it back to image.
Please, i need you help.
Thanks.
Please elaborate!
What do you mean with converting an image to a short hex string??
Are you talking about MD5 or SHA-2 hash keys?
These can not be converted back to the original dataset.
not possible. if this would be possible we would not mess with jpg and formats like that but just have that very short strings to save our pictures. data compression is an advanced topic and there certainly is no magic new and easy compression that beats very well engineered algorithms like jpg by creating just a few bytes of output that still contain the same information. period.
When you check the below url, it convert image to hex and then hex to image but very long hex string.
when you store the hex string into the memory of a chip, it consume the whole memory size that was why i need a sample code in vb6 that
will do it.
Please, help me.
Thanks.
When you check the below url, it convert image to hex and then hex to image but very long hex string.
when you store the hex string into the memory of a chip, it consume the whole memory size that was why i need a sample code in vb6 that
will do it.
Please, help me.
Thanks.
http://www.vbforums.com/showthread.p...t-image-to-Hex
That's a link to this thread, with sample code to convert a byte array (in this case an image) to a hexadecimal representation in text.
You still have not explained what your goal is.
Store the HEX text representation of an image in memory???
Well basically that is not going to happen.
If you convert a image file into Hex characters you are going to be doubling the size of the file. Using a compression method like Zip or Rar or whatever could make it smaller but then you don't have your hex characters until you decompress the file. If you try to shorten the hex then you are also modifying the image or making it to where it can not be reproduced.
I really don;t understand why someone would want to save an image as hex characters anyway? Seems like a waste of space and a waste of time.