1

My application requires a image that come from medical instrument. The Instrument send me FLOATLE-stream/deflate:base64 which I need to convert to image. Data is Given Below

5M|1|HISTOGRAM|RBC/PLT|RbcAlongRes|FLOATLE-stream/deflate:base64^Y2AAgW5nMMWg7wIkHEAsAA==|FLOATLE-stream/deflate:base64^7ZRtUFRVHMZX2DGoqGWkITIacBTJHCIGiYS457mbMQw06NAw6GCDySTDtE6MIhkDIpoSkBj4gkFBQogGteYqLwGBoQgGCRES15EoQLwaFoSHUWj0X7gfyS/mhPnVmf3N39rz8n/M7d49GozQbeeahyeQzRfALcYFGU0iuYbZP+W2H3mBeGmBxOBzQsLInQG+8T3LTe0o2XWuk0Zgt0nBSuhQRmCc168okv54aqayoVXI2mKUsn3FJmV8VbSPimnVimYeTGMh2FXk3HxXPR3oJu4aV4twSvUhODxZPjoeJ8bBIUVoZLTY4G4RTarzoGEpi/y6xKGIvx2SInposj6ssROa65HJsvQvYUcnyx0I6Wck65qA09yXmnxTZTFefWCg+nsyI9+LwYTmoRemObKOjvEBaHyyIisFeYtl8R9mUDwmAeFs26MeGmvyZS428I87Ep4ddj4doavFZghdJKLbra50M7agMv7T3Y4GyHLJ/7URtqj9GYBXBKfQCBeY7YZnJCcetCdAw5Q3F4fcEiDC5djG4/N1wMdUfdxmUwJixHUYYHDhV4Iu2UFxKbvLG51wdR4774Is/bDs45P46nHJPCDR8L0sN+0CtaJgZjcF4SrR4PRe+Y5tLWEosG8BqaJMJTMD8eRhyKQ6bEOyXIk4sJfQHRsFMKTX0RQdjT8S17C49UxcG2LhUP/y7hrcjOmbeMw5rwFV56IR/uqBDSu3Y4KQyJO7ExC/sEdaOpM4fo7UT2Syhq7UG7ZzTp7UKjby1ppyF78Buul43XfDNbMxKshb7LuPsRGZbH2fqzf+hbrZ2N1Wg4zH0ICcf5A5DmGF8TCz5MK98QjzvI2F3XnMlA+7sXeY692Zd27a9j16O8p8RXRXzIzv018Jcx6jw1JmPU6PJ5j3A7osY+Zy+vyQuT+iUyOyjp+k14+RWnuKbk3Y2n6afs9g02AFHVdi3XQVPX+CELsauq6F5FpH35/Ca0U9nTdgSdBZev8Mjusb6f4c7o47T/9NuLX7As+gGeO5LTyHi+gv+5xn0Yqv6tt4Hl/Q2SU6a6ezDjr7k1s466ayLzi7TWTedfU1nPXTWS2ff0Nm3dGamsyt01kdn39FZP50N0Nn3dDZIZ0N0NkxnI3R2lc5+oLNROhujsx/p7KeZ/+i07c90NkFn1+nsBp39QmeTdHaTzqbobJrOfqWz3+jMQme36Ox3OvuD/Rq5qVMjN66dJzeY58l1G63k6hErucJgLZsmrGVjglYut2jVO+JOWor0V5Q7RIjZO6ae9Cl3DfPriCCvkP3qvVNJLpERM2oXZO8qBuJDlxJN4E1/iTwR5RkXMwV/FW52jzHVX13mYPKiuqyP3yrN1ZvYqz9adUu9AJUefSrea7YJKvZrXqFKq7iFXRdlTmkqKuk+FKJXV6v4VPFVcVHQqmjn0qe7q51B4Gyn/APEvo7kDbn9X/kv+b3/X/gQ=

I tried Convert.FromBase64String(); But It Shows Invalid length for a Base-64 char array or string.

enter image description here

Rakib
  • 21
  • 5
  • This is far more complex than just a one liner in C#. The string you show actually consist of 7 fields, each separated by `|`, the sixth field base64 string is after the `^` character until before the last `|`, so it's `1Y2AAgW5nMMWg7wIkHEAsAA==`, you can decode that to byte array with `Convert.FromBase64String()` and then inflate that with https://learn.microsoft.com/en-us/dotnet/api/system.io.compression.deflatestream – Martheen Aug 11 '22 at 15:05
  • However, the last field doesn't actually contain a base64 string, that are *two* base64 string put next to each other separated with //. You can decode each to byte arrays, but the first is definitely not deflated (inflating it will throw exception), while the second is merely a single byte of `3`, very unlikely to be deflated stream. Check your instrument documentation on how to interpret all those values – Martheen Aug 11 '22 at 15:07
  • General Decoding: The image data must be uncompressed using first the base64 and secondly the deflate algorithms. The data must be converted from binary to text format. – Rakib Aug 12 '22 at 06:21
  • I was updated by base64 string – Rakib Aug 12 '22 at 06:33
  • See answer here https://stackoverflow.com/a/75568824/2836621 – Mark Setchell Feb 26 '23 at 00:48

0 Answers0