Ad

Python Convert SQL DataType Image To Python PyQt4 QPixmap And Show It On GUI

- 1 answer

I'm trying to display image from SQL Database in Python PyQt4 GUI, actually the data is being passed through socket from .Net to Raspberry PI, and here it should show as image. I have tried many ways like converting that string to base64 but that didn't work for me.

As I'm new to Python I tried many stackoverflow question and their answers but none of them resolved my problem. I have 0x in the start of the string which I removed to get ByteArray which result me a bytearray.

Here is the code I'm trying:

import sys,io, os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PIL import Image
import base64

imgbytes="89504E470D0A1A0A0000000D494844520000020C0000023B080600000080F9C31A000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000097048597300000EC200000EC20115284A800000260949444154785EEDDDBB521CD7DA06E0C57F2DE0C0E52B18AE003971E474674308893285CA94402832A78E9C08AE405C81CB81E05EF8BB6110A799F9FAEBC34CF7F03C556B6F5C25869E3EBEBD8E7B77950200B0C6FF2DFE1F00602581010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000218101989CABE3BDB2B7B7BE1C9EDF2EFE35D00781019890DB727EB8573E5C2CFE738DEBD383B277785EFD06D007810198909BF2DFF5E24760A304060020B4C381E1A1EA7259DBE6DAA20A1300DED8D1C070558EF70ECA699BAACBEBD372B07758F497028027BB1918AEFE290DFA44AD715DFEFE263100C0A39D0C0C57FF748B0BB5EBBFBF699A008085DD0B0CB7E7E573F7BC502786A29201001EEC5C60B8FDF677E967D4D57539FD72B5F81978A9EE27B4A4D3F0AB72EC12829DB16381E1B67CFBBBC741DA17FF54B745E085DBF372B8F7A1513FA18B0F665C845DB15B81E1F65BE9332F54B7BBF28FC40000BB1518FA6B8E7872213100C02E05869E9B231E699600801D0A0CBD37473CD22C01003B131832CD11B3D96CF153339A250078EF762430649A23E6E5D35F7F965464D02C01C03BB71B8121D31C31FFA31CEDFF5EFECC2506CD1200BC6B3B111832CD11F33F8EAAFFDD2FBFE71283660900DEB51D080C57E54BE36529E7E53E2F54F67FCF364B7C9ECE0A96F713EB2C9F79EFB1984C67E4AE8E971EB755C5F1EC6082D7CBEDF9E1D2ED7C5BA6B2F2EE9A99434D173A1E77537739BFABBF46A332BF5CFC52EDE6EE6CB6E4DFAC29B3B39BC5EFF6EDF26EBEE4EF3D95D95DFCA7A3CF585D5EEC96B4A6FBB1C977C8BB9C2FFB5BAF4AB72FB821ED8FDFB2D2CB57BE39BBAB42F5D2CF1FA4CCCEAAB32992DC4F2B3F735BD74B5BF9FBD5B232C83D2C3C4FE6D5DE5EA5F97198C465BCE3261F181A3D3016E5F5097773365BFAEF56964637B4ACAE0FDC7E6E24EB2FEA55B237DD367F63B5D4F11BE4D8F52013785B942E0F88CCB5D557891F0A5D03C336AF9736DA079BB5A5B7A76FD3ED5BB2BFB2E7BEC4B075136F92B82ACD57B27E6A8E78946E96186405CB9BF25FD31695D7EEABAD0F4AE31699B52ECA87BDA1170BBA289F7BAB1F4D4ED475FD5FB5A7C7645105FBA18FA55557BB3E3DB8AFD6CD1FD7DBF2E3DFC58F1BF4EF8F01EBCF2776BD5C1DD755F2CDD6EC48BBF8507D760FCD15B73F4AABD3A43E16039FFBF46FDA81E1EA9FE617533D3A62F1E34FE9D112D7E5EF91AC797D7F3319E082AB170B6A7E133C28BFA6F65F9DB9BE558FA23E2483D6ECD76A6BC7E1A1FD79A007C10AF5717DCF6DC1F7FB7C90EB65883E020F6172F8E7E975393DD842FF0C6161B2261D18AE9A572F2C4647BC961F2DD1DF03AFADDB727E38ECCDE4E2C37175CB6A22BFFF7AABA5C984C5CAECCFDFABADDDBE3AE81DF4F38A9B57BF55360E0D1D6ABE46E6DBA0FBBC7EE836BD5E1A48AC04DA97BA166A63A1A1FE7E6D6F5EFFFED8F2BD970907866ECD118FC6D12CD1541D16FAAA525DE7A27C68F86049EFBF9E6A693261B18A0BE5CFDFB71F17EAB0B0F517AB5468D801D7A7E574F07DDEFC7A59EFAA1C1F9C361E22DEA73A340C7F5A6CEFFBD18FE90686CC1BE6BAEAE8C9344BD46F329B080B0BD583A5D10D24BDFFAA6FD2B9962613162BB33FCBB6F3425D253E9A5AD846C736DFDCF4AE751E765DBF0C6CB666E1B5E6358BEDFC73BCDDEF4777930D0C9937CCF5D5D1536C96D88C6693556DA159626ACD1157C7DB6B865861E887C3FB5305FA2FEDF7E8EDF9FF5ABC0CCCCAD9CDFD48B7B7E5E62C59F357EBABA664998B72D1352DFCF6CB289A15DFB3890686CC1B665C1D9D6F96382D1DEE0DD3D1700D8DFD934F65BEF8B9996EB534D36A8EB82AC75DAA16E697CB1F0875B9CCEDF597A287C37EF9E5B7C58F1B338EA6A3D6DAAE39737B5EFE974C0BF3CBFA1CF85E4E56EDAEFD93F2BDCD3932A509EAD8BCEAC63339FD8FBF6F31367BE3E3981B94A5DFB5DBB8F3A65F333F66BFED38F6E4F7D9F2FC0BE9B93E1625357F42EBB91C82C9B4363D7153A3936D37AE97E772D74E8B09D0B2C731F32536788E0C37711E4D4D3030E42EE8A62759FEC6DED7C42D3DDC009B3C14DB5ED8CD13C3F2DF5F53DADC5CB3DF63BB379976C77613FBE5B1B4DA3F5B3D063B72BD3C4AFE9D56E74625777F4BDCDBDAEEA7376559107A7EAF1F66A65872A61718522768E2246B71E2B7BD785FEA7803CC6C449B37D1C66FE82DDECC5AECC0DC8D6FBB379936B50B9DCEA956350D2D826FF25A19556018CDF5F22055BB90FCEC9772FBADF16EEA21306C37D49331B93E0C99952953BDE35BF4F6DFF60A96D58556EEBEAE182FBACCD1D7926EF66E3C43628BCE8FE936DFE4EC8E5B1D1D91DCD6DAFCB2640EE71B6D8E6F793F4BB78FEB7AA9E546FBCC3F9D74E8F47754FE487C974167DC7CA63E26DF5776C4606C2616187237E15CEFF84D3CF0FAD3F6423BCADC3592F27332241F56B7DF4A2E2F6C717444725BABAD2D671FBBA48507471FF3BDE337F570D8A6315E2FB9D13EABE792692AF35D3631124C58989E690586D44D38DFE37AF0075E5FAA37D1D617DAD11FC9110DFF96C6CF93A16B696EFE6B5EBBD4E2F8F729551356EBAB3664FFA47C4A3EE3767E98F048AF97DBCC621DCBA6B6CF3AF8B5F9FD6DE8B557BA1C13B666528161B0E68847536896989D959B4EF5D6434EC8B35F4EB24FAB442D4D6A38E5C49A23FAAC0D39482FF031B685B97A34DAEB25595BFAEBA6574249BC28A4CDCB65A763C2B64C28300CD91CF1685ACD12ED0C3CBE3EFD46D67405CB5C7BEF76276BCAAEC3D06F6D48BEA66CC887C3D40D75BDECCE5A1D59F3CBAFDD6B4BD88AE90486819B231E4DA659A283F41B684AAE7355AD519578AABD77CB1300A597FCFDADFCD2E7E6EEFF527D62C675F96F67AB18BA1BE47A499E238FCB94772AA9751C063A27BA76EC65AB261318066F8E78D4A659E2F3F90EB701E76F1CE98E620DA68A9E4E734425D5D7A2D2FBD2DBD681D89E86D74BF61C8111984860D84473C4A32DAC8DB06B8E3E96B3D42E8CA68A9E5273440B239823FF3D8C9400BA994660B8FA925898A57B7574BE59625B2B588E553E74AD6D964855DF6EB939A292EAFD3E886DAC0341C6F6CF11C89B4460D87875F456966CDE2DE9D0B5A6966663CD5100AC3481C090AB8EAE57923C58D6E127550EF24BCD6A9678291DBA56D5D26CB2396A3B363F640E22B3E2B4E4B5F1078654EFF86DD22CF1527E4E86EBD32F6F87A86E6874CC365D1BA2C0D8CC3FAD5E3A9B776BF48121D51CB1659A255E693127C3EB21AA9A2360C3E697B935377837461E1892CD11DBA659E295FC9C0C2F67CEDCFDE688B1F8ADD78920E8DBFDC2590FAB0B0F5F840556187760984C73C423CD12AFA517437A3173666636BCF13447EC678728FCFBA3E79AA9DB92EB84AFBD1A888D3A304CA939E291668957D29D1F9F354B6402E3949B237A5FCBE1FD4E3B3C15E950092330E2C030B1E68847D7A7E5CB9B9E7BEF597E4E86C766894C601C5573446655C07B3DAFE5B0EDA9A98925CF111D631983F10686C935473CD9F80A9623979E93E1BE5922131847363A62CB6B39A497D6EE63E96472B2E7C8E416B963178D3430DC96F3CF538D0B1517F74BFB272537C2F2A27C3EFC3CE1E688FC5A0EFD85CC5C47D1DAD0F340783B5E267B8E585194ED1B6760488DBDAFD46BDE2FEBEDDB4BB949AE8B509BDE0A9643CB2E48757DDDFC0418DFE88836CBA47F2E8D56F98E64AF9DB1D5CEBC1BD9E9BBAFCBA9B64EB66C9481215BA53AEC03A3C5CDBFA259E295F49C0C4D8DF38197EFD4D6CF089BAB2F99258C2B9BA89DE97D14C86E48AFEADA57A88496461818B255AAC33F30F28B5155344BBC929F93A191B18E8E681190AE4FFFD7ED8170755C3E245BF236523B637E92E5D2E7C87539FDDF2E2FA5CFD88D2F30A49B2336F0C068B118956689B7D273323430DEC99ADA04A4EA817070DC2E685661612F9B16AAC7D5A736F3FFB6E8D4E941B74C8B73A45E2BE7B0EF7D79558E1FD7D1E9FDB3D925A30B0CE91EDEBFFDB281078666895EB40A5EEB8CBBFDBD5D40BA281FF60E53350DB7E7872DC242B5F7CE3EB61C1D91EFD4F9B028DCF2307475FCB8E85BEE7BEF8274B344ED7E5F76DD57B7E5FCF071BF7F78EA60AC368835461618F23DBCE77F6C66409866893EB40B5E2B8D7DB2A6F4E89047754DC3C3CDFC78CD09F4F8A03D482FAD5A6B59BB702FDB61EF511D861E1F524FE529EBF43BBC74128E3EB6E8545D7B3A47F6D69D24CF3C05B3BAAC5A91F71D1E031A1B576048F7F09E970DE585966FC717E5B35E4A2FEC9F7C4AB7EDAF32DEE68827475F2F3B7DDF8B0FCF6FF22F4B8B4A859FE6975F3BCDBD7090AE6268E6DF77377670BF9CFCD5B1A9EEE2C3D2F3E375E972BE406D548161DC13CEB47B3B3655F46B7D757E9CCA70C0A3F2F5B2AF88D48F7A21A3AEEB0BB5AA7163B9FD93F257BB6A06D8A8110586F136473C6A7593D426F846AB76DBD7C6DE1CF1DCD1D7329ACC30BF2CDF5B37453CD37B7F94F76DFFE4AF964D13B039E3090C636E8E78D4EA266905CB377A9893610ACD11CF1D7DBDDB7E68A8C2427F4B17EF9793761D3458AADA9FDFDB4C12079B339AC0308DF9EF354BF4E3A87CEC74679CE6EC847568B8D9D213A16E86E82F2C2C8CA9E66427D4A161DBC1D252E7AC3692C030FEE68847ED9A25FA5EBE78FA3AB5814FA939E295FD93EFE5EEA6FFF928569B97CBBBBB7E9A219638FADAEF5BF16F96CDBC0F96775B4A0DB3B3BFCA40A70A3B60549D1E9BDB4273C4A3DEDB6E5B8C69DFA881DE385A0F39ACF3C2B49A23DEA8BEFBF7EA213E746DC3FCB25E0BA5DB6888589F6FC54DAEEB7772BD1C7DBD5FCB6663B961B11E4F3A58A627F162D2AA9372242EEFAA6BE3AEDEA4B5657676579DD85BD6705B17A5BA71076EEEAA67C7D2DF7D51E20F6AEE72BEFC6FBC28B3BBB34177766E3F3E94A1B7690B6ECEEEAA67E092EFDAA6CCABBDBA259DBE4766BBDFE1F5D2E8EF274B6FF7D266D7F16CE72EDCF767AFFE9FEA60C27664A734AEDF84BE9F4CBB862150CFDC98998CA9AE49E8BB7B4267B7E7E5F0205E086B94DB3E01D973A4BA70CAD9CD77CD0D742230B045F5F4B4AB669C5BAEEEBC37547B3C00AB4DB40F033B213D94769AA323007681C0C0D65C7D89ABAC5F98F0E80880A91318D892ABF24F726EFBC98F8E0098308181ADB83DFFFCB4A46E239A2300B64960600BF21375698E00D82E8181CDBBFA921A1951D31C01B05D02031B7795EDBC50E6E593A194005B2530B061F9CE8EDB59680C80E70406362ADFD9B1CE0BE202C0B6090C6C508BCE8EDB5C680C809F040636A7456747CD1100E32030B031F9CE8E9A2300C6426060435A7476D41C01301A02039B71FBA3FCBBF8B1A9D9D947CD1100232130B019FB27E5FBCD59992DFE739D7A09EB7AD575CB58038CC75E7563BE5BFC0C00B0941A060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000A1BDBBCAE2E7DEECEDED2D7E02003206782CF7420D0300101218008090C000008404060020B4B14E8F63EDC40100DB32A5E7A51A060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C40E8F6FCF07ECEFBB5E5F86AF1AF815D2430006B5D1DEF9583D3EBC57FAD71F1A1EC1D9E97DBC57F02BB456000D6B82D3FFE5DFCD8C4F57FE566F123B05B0406002034E1C0705BCE0F97B4A3BE2987E55C1D29ECB6ABE325D7FEB88B2E1F4CCD4403C35539DE3B284D9A554BB92EA7072E4ED85DD5CBC3E78BC5CFD371F1597F0FA6459304307137E5BF462F0F23A3BF0713233000D376FBA364FA658EC7BFE5872A06264460000042020300EF50DD176E7987D4E745FFB727020300EFCBED7939DCFB509A7495BDF8B0570E0DB5BB273000D3B6FF4BF96DF1E3B4FC567ED95FFC08132030001377507E9D2D7E9C92D9AFD596C374080CC0C4ED97934FF3C5CFD331FF74526D394C87C0004CDFD1D7727777D7BEDC9C955C25C5AC9CDD2CF99C44F97AB4F828980881010008090C004048600000420203001012187A7275BC7C96B0E5C592DB5332E5637B7B7EB8641B9F97E36222BBDD111FEFC7328EF3B4F1F61E5AD9730C0486566ECBF9E1CB13FA436A75DD8725B7FBBC181A5F78BDCD73FA761F2C2D7DCEAB7A75BCFC6FBC2ADD66651BDFB1CD7A7E2E1C846BC05F940F8FDB6A0EDC097A79BEC6C7FBD1CBF374733319B6DCDEEBD372B0F89DD4F6DECFE8F8F47B3FCBC169B5079ABB3E3D78FB19CBCAAE079BBB01D41FFBBAF4EBF26EBEE46FAC2BF3CBC5AF7670395FFED9FD9579F5CD5AB89C2FF9AC35A5F3CEB8B93B9B2DF9DC55A58F9D7F7376375BF6D92B4AF64F8EF6D86664CF8315E5E5BE4B1EEB4D7CCF2124CFAF52667767378BDFDD8AFC3DB051E9E35A5D6A98ED9D050761F8EBFA6DC9EEC2659F31566A181A78AC92CEBD69B6F1F0B63778DAFFF747B7147CFBADFC9D89E717FF74AEF6BEFDF677E28D60567E6D3885DE6E1CDBC55B5B4F5FA29E3B5F15F0783D9CB3CDD64148BBF8507D76BFCD150F355EC36C6FFDE6BFFA9ABA2D3FB6B0EEF9BF3BBC66B9C0B0CEA23A6BF887C94BEB2F82250E7ECD4D3A73FD77F9D6E59CBEF92F559DD77DDDFFDBF22D95501ACCD13F95631BAA57DC3B288D6BA29BBAAF02D6BF615C1E56571CFE9C7D68AEE8E33CADC34DF3669276AEFFBB59FCC4D0048695AA8B33D9CED5A7FAC1D2B84979FFF7F2672E3194BF3B2486AB7FB277AC6E7FAF4A28E5BFCC8108E7E89FD0B15DABAE5918E84DF35E5D2B324018212FB1BA625FBA86DBBA666123817C658D69F2BE41486058E5EA9F8D5E9CCB5C7C68FA86B75F7ECF25860EA9FCAAA4F342E5FAEF6FEDABB893C762F6E7EFEBE7E89FD4B15DEDEAD8C3FC7DD85EC06D1D6EAF8E07AF5960F30486156EB7D1F8F546F586D7F06ADDFF25B9C06FDB7E05B73F4AAB3D73FD5F95F7DBC91D8B59F9F3F7F5ED11533BB64B5537E44D37A7B00D43D722C5F2E1B6DAE6CF63383927BA8AE988090C63D7F4C17EF447C9ADD77751FE69F1BCCA753E7CAEDDDFAB6F3EBDF75F188BD69D41AB374E69E15DB83DFF5F8B5AA4350B63A517D9AA25C3EDD597FC36CFCECACDB2EDBD2F97C97B1B43111856C8BDB1CFCBE5D213FDA9DC9CB58DBA4D1FB447E58FE455D5A637EF4D8746C18B760925372263FE47B527D69BDEB17DE9F6FC73F59BECBCDBF3F2BFE493777E599F93DFCBC9AAD0BC7F52BED7E7ED65F26671F1B9F1C8895C1FA745B8F9BE6EA9EFA3F2F5E7F5B6243CFCF6CB8ADFDD2FD98AD7EEE21ACE49AB0E42EFEA8F7D5DFAB5817918A231EDB3B3BB36C3B05B8D0B6EBAF1D971F8E9EFD0712C759B7D96FC4E8D76D5148FED4FDD8EC1F271EBD9B916D615F330F425773EB5D89EEC776E7671A5CECFF4E9FFD3D339BB762E86F471ED585A7CA1659F335602C34ACBFF46FB13FC49FAC1D2F40196BE389237F7CE175FFEA696DB574DBFCF048FEDA3B6933335FA3BDDC2C84311187A91DC9EB6E7EECDD96CE9E72D2F0D8E6D6ABBB778AE24F76F34415417CBFEDE58699258E9A87C7C56D55C5D90F5512C5FA3FAEE068E3E26DB119B76184C0FAFCC5589B7EFBFF0283BBC323922A34173C483091EDB85FC90D64ADD3EBCB6CAF7D143D56F157AD8B2AB2F895111D5F1FDD8F2DCDD3FF994E81FD0E07E9199A3251CFECCD8080C6BEC9F7CBF7F90F4F530F929FD606F2A3FBC32D3AFA04BFF8547A9E19CC91119F33F9A1FA4E91DDB5A9B21ADF372D9282C3C39FADAA55F06DDE58EF3FC53EEF8BE94EBFBB4CBB318121318B622FB606F3E53E2FEEF7FE6DE701B4F13DD6EFE8537122303869A0E7A58C31DDB36F347CCCE3E36AC7579A90E5442C396A48EF3BC2472F2524789C4D0693E95D7BACE38CBC6090CBB26FB86DBF4A26D3BFFC21BCD9B4152351AB33FCB2E774EAEE5E78F98974F2BBBCBC7EAD0A07962F352C7B97133DC1A99A9E5A326B4D434F5F514D4A61F9F1281614BD2132D35961D4AD4AC5F41F7FE0B4F9A556BE66A34C2D91D376898639B9D8FA2D2C3C3E4E8EB4D51D1B049B9E33CDB78B55A5023B6FF4BC99DFD0F8BB2F533553A4313187650A68AB1D6A45F411FFD171E35AAD64C55CBEEF8D8E77BF979F1337D3A188BA9AF7FD06E76C5FB15527B5E2593FE090CBB283BEB63D8AFA0D9DBFE7CDEF0AF3668064955CBBE83E688BCEE6DDB6C41B2E9AF5EEBA15E9EBD5349AD53715DD6BF5FE43B5E3F795825F37E9B2CAF3E4A02C34ECACEFA18F42B68F4B63F2BBFFED1B4FD32BAE924ABDF57CEF4B643B27D480C599BA6F4D2F1E3931BAAB9C2FDF2EA0FE14173C578080C7DB93A7E99DAA332F05A0007C97AC175FD0A1ABDEDD76FF947CD3B5CAE1FCE99AB961DBCEA7D0CC776071E24BC172FE739E9EAA1B9A22A92C3D6090CADD42BC83D7B400CF590E8203BBC7275BF82666FFB0F9D0E13D591EB9A41363CACECA5F11FDB46DE43ADCB0E1AC74AAADD0D32C2E6E2C3C3F528386C8DC090707B7EB878881CB458416EC3D2C32B570D976AF6B6FFDB6289C8E6230456F7B64ECD66D8C7B0B2CAA48E2D4CC060236CEE83830E92DB203034B1A8923E98D49324DBF968453F86466FFBCFDEF21B77B85C359CF3B6E486A1778C0B933CB6B02D9909D2F6CBC9F7A1A61A7FE820A9B261B30486C0D5F144ABA42BD9F90096F52B68D67FE17907BBE61D2E973683A496B3EE36BBE3948F2D6CC5FCD3EAA5B357A8A71AAF57651B42DDBF4168D81C8161A587B6EC493F4FB2C32BDF4C139DE9BFF0A47187CB65CD20A9C56BDA0EA7DC81630B9B36BF2C776D175E39FA7ABF6ECB10D38D5F7CD03CB12902C30A57C7BBD0969D1C5EF9667E845CFF8547CD3B5CBE6D06C9F45F683BBBE36E1CDB40E3354298B2D9D9CDCF45D4062F3DACD2F673D1B75E6B1CAECBE917D50C9B20302C7375DCE1ED735E2E5F5F68CBCA8626E9CFCDFAF8AA5F41B6FFC2A34487CB97CD2099E9A05BCEEEB843C716266B51E37077D753C7C88BCF6A1936406078E3B69C7FCE3F519E92FED75E7AEDF726D92CF17C9AE87CFF8547890E97CFDF84339313B56A8E98F0B14D2DEA538916096294865B6366AC1E3A46760FDACDD6C4A11B81E1B554A7BBDAAC9CDDDC95EF1D56051C56726EF79FF323B4EBBFF0A8F18DEF5933486681AB56CD11533EB62D16F5593B3716E3940C864DD681998CC75A879BB35C385EE875E96D969A6660E86DA9E5259233EACDCEFE4AF71ADEACB6C32BDBF55FF8293DBC32371DF4CABFBBCEA48F6D7E519F66AB8246A6BE18D2C4648361B80ECC04ED9F94EF6D9A2AD4AA0D4E0DC32BA94983AA47E2A771A7857BD9591FEF1F346DFB2FFC94185E79FF96947930B59BDD71DAC736BB6C791F6F5CF568920F0DCE03FA930D86C172D3935537556443C370FB62A76A723A986460C8545D3FE8365E7FA5A92CF0939CF5B17ED09C3779B806B32C361E5E59BF2565A683EE6976C7B546786CB3EB83D40BF874E93CFE2E46938C4E3618EEF208812E2B5F3284090686E44A8629B95906A7237913BAFEBBFCDDA8BFE3FA476A6678E5E7CFCD777CBBD91DA77F6CDB7488BBF8DC6E99E07A522BF3546C476E6453658747088CA613A861CAF7C611187EAE06781CB7C75D7D69F1D6F35B69D3E43D9C76BDF5BBC80EAFBC0EF77183618D899A8DEBF80F2EF4BDD854DF063CB6D989B86AF532C1A9A9F0EA66086161ABD2C7F9BA9CFEAF5D30ECDF5539BEBF97F73303636E31AE01EFF36FE6A8799F4611189EDA962FCA87FB936DF9CC5DF70B04B5B99335AE5ECEBF89B73989B652D5DBE661B356938B33DFEE1E6ADD54B00BC7363911D7A37AB19E2677EFDBF37268F1AD1168719CEB6078D87768787AF8EF35FDEC674D8B0FCB523778095C29599B9CB937A4471D8D29946DD1DD00EA8F7D5DD6399BBDFDF7BD96F9E5E22FC56ECE66CB3F6355497C76F5E92DBFEBECEEEC66F1111D5CCE977D76CBD2F47B5FCE97FF7ECB32EBB02376E2D876DA9FABFED6E55DF57C5AF2EFDB9479F56913747376375BFA7D56957EAEC9955A1FE7AEDBB5EA3C6EF6B9ABAFB1FC76A5EF571BB95E979FDF4FDB9AFF9E6FFFC6208FE55EBC8B51129936EF749B59F5F676D8A40171046F6FE94E736B44FD177EEAB566A3E5EC8E0B3B716C3BEDCF8715FE1E9AFF9E17232146E7E863CB19109F1DE3866D02F78BB0FD3C17569DC7D7A5DB408167DB15D4563C6E4FB63239D7B7A96DEDE7632DF8CBF2B4AD5DF7D3B8BD83C0906CF36E7143BE3E3DA84E9A15556FF70F93EAA43A38AD4EA5EDCA0EAF5C2DF3E06E598DBE4CEBC5A61676E2D81E958FED9E244CCA7E39F9ABDD04463FD54D51CF1E6AABCAC6FBABD4CD274BB6E3B1B4DB9E7CDFA63E5FA09EEB67FE9371DAFDC0901E82D7F601B73C798E2128FC941C5EB95AAE73515F1766DBC5A69EECC6B1DD3FF9AB9FF9F719B7FD93F29703DDC8ECEC63F23EDFE70BD4FBB1E3816156CE3E664FA3EAB1F2B163B21FAD9EC6352743585F1766ABD91D5FD98D63DBC3DB674A3D45F66587A610DA9A5A38DCCA30C8D959F9ABCD246BBDBD40BD1F3B1D185A4FEDBBB1643F2F671BBE1BF4F1F06EDC7FE1512F17664FC32977E5D8D6D3E76E6455CC3A2C7C1FF9F4E7BBACCD8C875B945D24ADB379B9FC7ED2B2E6B1DAB79FC4E08CDD0D0CF3CB4E8B06D5EBB60F7A3FAE52F1CDDDD7F2FBE23F37263D9CE8B5361D0F7B185ED9E3EC8E3B736C8FBE969B419F24F572DEC2C2F6D5A1E16ED87336D470B6DC2AC86EEE195C9F9F1D5790ADAEA1EDEED769194560E87DFACFFA86FDB5FBE3E5E8EB4017691566EE5AA7E2AE3A76426CD9F1303D7BDD2BED66775C6D578E6D1D7EEA315DBDABBFC7D8966A7FE7EA73769063DD40A6B6B6DECE61836C6511CAFB383F8FBEF65B83D347D3E9682D8657F6AAFED8D765BDFEC6817719A7BF526F7309BC1DA3DB6C6E80AE63AB5F498F397F2AEDF76FDB71CF55999D55BF3D909D39B67D5D43ABB6A7E1E70F79AC8634B6791802556E58B24D03944EC7B3CFF93D9E4A6ABA85847EF6697E1E92659F335623090C0F9ADD605794A1CEA267BA6CDFEACD8B1FA4C37CB5FC03BC8FED48EFC30D1CD7DACE1CDB2127FC091FAA139DB4E9A786D7C49842516F81F759E9FDFB757859F8593614D03ABC4CB53DFF977DD6588D2A303CD7E806BEA187C9520D2ED4416A3B18DE8E1CDB26D7D0362F21FA970FBE9BAF2969BA8D5BBFC61A8687AED7D0B2CF1CABBDFA7FAA0DEC553D46FDB501FE0C004CDA949E97BB3F711300D099C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000A1BDBBCAE2E7DEECEDED2D7E02003206782CF7420D0300101218008090C0000084040600203448A7470060B7A861000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000008152FE1FC0C2101D11A155990000000049454E44AE426082"

data = bytearray.fromhex(imgbytes)

print data

#creating window
app = QApplication(sys.argv)
w = QWidget()
w.setWindowTitle("Python Image from Base 64")

#creating widget
label = QLabel(w)
qp = QPixmap.loadFromData(data)
label.setPixmap(qp)
w.resize(500, 500)

#showing
w.show()
app.exec_()

Any help from you would really be appreciable. Thanks!

Ad

Answer

You have to create a QPixmap object and then call the loadFromData() method:

import sys

from PyQt4 import QtCore, QtGui


if __name__ == "__main__":

    app = QtGui.QApplication(sys.argv)

    imgbytes = "89504E470D0A1A0A0000000D494844520000020C0000023B080600000080F9C31A000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000097048597300000EC200000EC20115284A800000260949444154785EEDDDBB521CD7DA06E0C57F2DE0C0E52B18AE003971E474674308893285CA94402832A78E9C08AE405C81CB81E05EF8BB6110A799F9FAEBC34CF7F03C556B6F5C25869E3EBEBD8E7B77950200B0C6FF2DFE1F00602581010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000218101989CABE3BDB2B7B7BE1C9EDF2EFE35D00781019890DB727EB8573E5C2CFE738DEBD383B277785EFD06D007810198909BF2DFF5E24760A304060020B4C381E1A1EA7259DBE6DAA20A1300DED8D1C070558EF70ECA699BAACBEBD372B07758F497028027BB1918AEFE290DFA44AD715DFEFE263100C0A39D0C0C57FF748B0BB5EBBFBF699A008085DD0B0CB7E7E573F7BC502786A29201001EEC5C60B8FDF677E967D4D57539FD72B5F81978A9EE27B4A4D3F0AB72EC12829DB16381E1B67CFBBBC741DA17FF54B745E085DBF372B8F7A1513FA18B0F665C845DB15B81E1F65BE9332F54B7BBF28FC40000BB1518FA6B8E7872213100C02E05869E9B231E699600801D0A0CBD37473CD22C01003B131832CD11B3D96CF153339A250078EF762430649A23E6E5D35F7F965464D02C01C03BB71B8121D31C31FFA31CEDFF5EFECC2506CD1200BC6B3B111832CD11F33F8EAAFFDD2FBFE71283660900DEB51D080C57E54BE36529E7E53E2F54F67FCF364B7C9ECE0A96F713EB2C9F79EFB1984C67E4AE8E971EB755C5F1EC6082D7CBEDF9E1D2ED7C5BA6B2F2EE9A99434D173A1E77537739BFABBF46A332BF5CFC52EDE6EE6CB6E4DFAC29B3B39BC5EFF6EDF26EBEE4EF3D95D95DFCA7A3CF585D5EEC96B4A6FBB1C977C8BB9C2FFB5BAF4AB72FB821ED8FDFB2D2CB57BE39BBAB42F5D2CF1FA4CCCEAAB32992DC4F2B3F735BD74B5BF9FBD5B232C83D2C3C4FE6D5DE5EA5F97198C465BCE3261F181A3D3016E5F5097773365BFAEF56964637B4ACAE0FDC7E6E24EB2FEA55B237DD367F63B5D4F11BE4D8F52013785B942E0F88CCB5D557891F0A5D03C336AF9736DA079BB5A5B7A76FD3ED5BB2BFB2E7BEC4B075136F92B82ACD57B27E6A8E78946E96186405CB9BF25FD31695D7EEABAD0F4AE31699B52ECA87BDA1170BBA289F7BAB1F4D4ED475FD5FB5A7C7645105FBA18FA55557BB3E3DB8AFD6CD1FD7DBF2E3DFC58F1BF4EF8F01EBCF2776BD5C1DD755F2CDD6EC48BBF8507D760FCD15B73F4AABD3A43E16039FFBF46FDA81E1EA9FE617533D3A62F1E34FE9D112D7E5EF91AC797D7F3319E082AB170B6A7E133C28BFA6F65F9DB9BE558FA23E2483D6ECD76A6BC7E1A1FD79A007C10AF5717DCF6DC1F7FB7C90EB65883E020F6172F8E7E975393DD842FF0C6161B2261D18AE9A572F2C4647BC961F2DD1DF03AFADDB727E38ECCDE4E2C37175CB6A22BFFF7AABA5C984C5CAECCFDFABADDDBE3AE81DF4F38A9B57BF55360E0D1D6ABE46E6DBA0FBBC7EE836BD5E1A48AC04DA97BA166A63A1A1FE7E6D6F5EFFFED8F2BD970907866ECD118FC6D12CD1541D16FAAA525DE7A27C68F86049EFBF9E6A693261B18A0BE5CFDFB71F17EAB0B0F517AB5468D801D7A7E574F07DDEFC7A59EFAA1C1F9C361E22DEA73A340C7F5A6CEFFBD18FE90686CC1BE6BAEAE8C9344BD46F329B080B0BD583A5D10D24BDFFAA6FD2B9962613162BB33FCBB6F3425D253E9A5AD846C736DFDCF4AE751E765DBF0C6CB666E1B5E6358BEDFC73BCDDEF4777930D0C9937CCF5D5D1536C96D88C6693556DA159626ACD1157C7DB6B865861E887C3FB5305FA2FEDF7E8EDF9FF5ABC0CCCCAD9CDFD48B7B7E5E62C59F357EBABA664998B72D1352DFCF6CB289A15DFB3890686CC1B665C1D9D6F96382D1DEE0DD3D1700D8DFD934F65BEF8B9996EB534D36A8EB82AC75DAA16E697CB1F0875B9CCEDF597A287C37EF9E5B7C58F1B338EA6A3D6DAAE39737B5EFE974C0BF3CBFA1CF85E4E56EDAEFD93F2BDCD3932A509EAD8BCEAC63339FD8FBF6F31367BE3E3981B94A5DFB5DBB8F3A65F333F66BFED38F6E4F7D9F2FC0BE9B93E1625357F42EBB91C82C9B4363D7153A3936D37AE97E772D74E8B09D0B2C731F32536788E0C37711E4D4D3030E42EE8A62759FEC6DED7C42D3DDC009B3C14DB5ED8CD13C3F2DF5F53DADC5CB3DF63BB379976C77613FBE5B1B4DA3F5B3D063B72BD3C4AFE9D56E74625777F4BDCDBDAEEA7376559107A7EAF1F66A65872A61718522768E2246B71E2B7BD785FEA7803CC6C449B37D1C66FE82DDECC5AECC0DC8D6FBB379936B50B9DCEA956350D2D826FF25A19556018CDF5F22055BB90FCEC9772FBADF16EEA21306C37D49331B93E0C99952953BDE35BF4F6DFF60A96D58556EEBEAE182FBACCD1D7926EF66E3C43628BCE8FE936DFE4EC8E5B1D1D91DCD6DAFCB2640EE71B6D8E6F793F4BB78FEB7AA9E546FBCC3F9D74E8F47754FE487C974167DC7CA63E26DF5776C4606C2616187237E15CEFF84D3CF0FAD3F6423BCADC3592F27332241F56B7DF4A2E2F6C717444725BABAD2D671FBBA48507471FF3BDE337F570D8A6315E2FB9D13EABE792692AF35D3631124C58989E690586D44D38DFE37AF0075E5FAA37D1D617DAD11FC9110DFF96C6CF93A16B696EFE6B5EBBD4E2F8F729551356EBAB3664FFA47C4A3EE3767E98F048AF97DBCC621DCBA6B6CF3AF8B5F9FD6DE8B557BA1C13B666528161B0E68847536896989D959B4EF5D6434EC8B35F4EB24FAB442D4D6A38E5C49A23FAAC0D39482FF031B685B97A34DAEB25595BFAEBA6574249BC28A4CDCB65A763C2B64C28300CD91CF1685ACD12ED0C3CBE3EFD46D67405CB5C7BEF76276BCAAEC3D06F6D48BEA66CC887C3D40D75BDECCE5A1D59F3CBAFDD6B4BD88AE90486819B231E4DA659A283F41B684AAE7355AD519578AABD77CB1300A597FCFDADFCD2E7E6EEFF527D62C675F96F67AB18BA1BE47A499E238FCB94772AA9751C063A27BA76EC65AB261318066F8E78D4A659E2F3F90EB701E76F1CE98E620DA68A9E4E734425D5D7A2D2FBD2DBD681D89E86D74BF61C8111984860D84473C4A32DAC8DB06B8E3E96B3D42E8CA68A9E5273440B239823FF3D8C9400BA994660B8FA925898A57B7574BE59625B2B588E553E74AD6D964855DF6EB939A292EAFD3E886DAC0341C6F6CF11C89B4460D87875F456966CDE2DE9D0B5A6966663CD5100AC3481C090AB8EAE57923C58D6E127550EF24BCD6A9678291DBA56D5D26CB2396A3B363F640E22B3E2B4E4B5F1078654EFF86DD22CF1527E4E86EBD32F6F87A86E6874CC365D1BA2C0D8CC3FAD5E3A9B776BF48121D51CB1659A255E693127C3EB21AA9A2360C3E697B935377837461E1892CD11DBA659E295FC9C0C2F67CEDCFDE688B1F8ADD78920E8DBFDC2590FAB0B0F5F840556187760984C73C423CD12AFA517437A3173666636BCF13447EC678728FCFBA3E79AA9DB92EB84AFBD1A888D3A304CA939E291668957D29D1F9F354B6402E3949B237A5FCBE1FD4E3B3C15E950092330E2C030B1E68847D7A7E5CB9B9E7BEF597E4E86C766894C601C5573446655C07B3DAFE5B0EDA9A98925CF111D631983F10686C935473CD9F80A9623979E93E1BE5922131847363A62CB6B39A497D6EE63E96472B2E7C8E416B963178D3430DC96F3CF538D0B1517F74BFB272537C2F2A27C3EFC3CE1E688FC5A0EFD85CC5C47D1DAD0F340783B5E267B8E585194ED1B6760488DBDAFD46BDE2FEBEDDB4BB949AE8B509BDE0A9643CB2E48757DDDFC0418DFE88836CBA47F2E8D56F98E64AF9DB1D5CEBC1BD9E9BBAFCBA9B64EB66C9481215BA53AEC03A3C5CDBFA259E295F49C0C4D8DF38197EFD4D6CF089BAB2F99258C2B9BA89DE97D14C86E48AFEADA57A88496461818B255AAC33F30F28B5155344BBC929F93A191B18E8E681190AE4FFFD7ED8170755C3E245BF236523B637E92E5D2E7C87539FDDF2E2FA5CFD88D2F30A49B2336F0C068B118956689B7D273323430DEC99ADA04A4EA817070DC2E685661612F9B16AAC7D5A736F3FFB6E8D4E941B74C8B73A45E2BE7B0EF7D79558E1FD7D1E9FDB3D925A30B0CE91EDEBFFDB281078666895EB40A5EEB8CBBFDBD5D40BA281FF60E53350DB7E7872DC242B5F7CE3EB61C1D91EFD4F9B028DCF2307475FCB8E85BEE7BEF8274B344ED7E5F76DD57B7E5FCF071BF7F78EA60AC368835461618F23DBCE77F6C66409866893EB40B5E2B8D7DB2A6F4E89047754DC3C3CDFC78CD09F4F8A03D482FAD5A6B59BB702FDB61EF511D861E1F524FE529EBF43BBC74128E3EB6E8545D7B3A47F6D69D24CF3C05B3BAAC5A91F71D1E031A1B576048F7F09E970DE585966FC717E5B35E4A2FEC9F7C4AB7EDAF32DEE68827475F2F3B7DDF8B0FCF6FF22F4B8B4A859FE6975F3BCDBD7090AE6268E6DF77377670BF9CFCD5B1A9EEE2C3D2F3E375E972BE406D548161DC13CEB47B3B3655F46B7D757E9CCA70C0A3F2F5B2AF88D48F7A21A3AEEB0BB5AA7163B9FD93F257BB6A06D8A8110586F136473C6A7593D426F846AB76DBD7C6DE1CF1DCD1D7329ACC30BF2CDF5B37453CD37B7F94F76DFFE4AF964D13B039E3090C636E8E78D4EA266905CB377A9893610ACD11CF1D7DBDDB7E68A8C2427F4B17EF9793761D3458AADA9FDFDB4C12079B339AC0308DF9EF354BF4E3A87CEC74679CE6EC847568B8D9D213A16E86E82F2C2C8CA9E66427D4A161DBC1D252E7AC3692C030FEE68847ED9A25FA5EBE78FA3AB5814FA939E295FD93EFE5EEA6FFF928569B97CBBBBB7E9A219638FADAEF5BF16F96CDBC0F96775B4A0DB3B3BFCA40A70A3B60549D1E9BDB4273C4A3DEDB6E5B8C69DFA881DE385A0F39ACF3C2B49A23DEA8BEFBF7EA213E746DC3FCB25E0BA5DB6888589F6FC54DAEEB7772BD1C7DBD5FCB6663B961B11E4F3A58A627F162D2AA9372242EEFAA6BE3AEDEA4B5657676579DD85BD6705B17A5BA71076EEEAA67C7D2DF7D51E20F6AEE72BEFC6FBC28B3BBB34177766E3F3E94A1B7690B6ECEEEAA67E092EFDAA6CCABBDBA259DBE4766BBDFE1F5D2E8EF274B6FF7D266D7F16CE72EDCF767AFFE9FEA60C27664A734AEDF84BE9F4CBB862150CFDC98998CA9AE49E8BB7B4267B7E7E5F0205E086B94DB3E01D973A4BA70CAD9CD77CD0D742230B045F5F4B4AB669C5BAEEEBC37547B3C00AB4DB40F033B213D94769AA323007681C0C0D65C7D89ABAC5F98F0E80880A91318D892ABF24F726EFBC98F8E0098308181ADB83DFFFCB4A46E239A2300B64960600BF21375698E00D82E8181CDBBFA921A1951D31C01B05D02031B7795EDBC50E6E593A194005B2530B061F9CE8EDB59680C80E70406362ADFD9B1CE0BE202C0B6090C6C508BCE8EDB5C680C809F040636A7456747CD1100E32030B031F9CE8E9A2300C6426060435A7476D41C01301A02039B71FBA3FCBBF8B1A9D9D947CD1100232130B019FB27E5FBCD59992DFE739D7A09EB7AD575CB58038CC75E7563BE5BFC0C00B0941A060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000A1BDBBCAE2E7DEECEDED2D7E02003206782CF7420D0300101218008090C000008404060020B4B14E8F63EDC40100DB32A5E7A51A060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C40E8F6FCF07ECEFBB5E5F86AF1AF815D2430006B5D1DEF9583D3EBC57FAD71F1A1EC1D9E97DBC57F02BB456000D6B82D3FFE5DFCD8C4F57FE566F123B05B0406002034E1C0705BCE0F97B4A3BE2987E55C1D29ECB6ABE325D7FEB88B2E1F4CCD4403C35539DE3B284D9A554BB92EA7072E4ED85DD5CBC3E78BC5CFD371F1597F0FA6459304307137E5BF462F0F23A3BF0713233000D376FBA364FA658EC7BFE5872A06264460000042020300EF50DD176E7987D4E745FFB727020300EFCBED7939DCFB509A7495BDF8B0570E0DB5BB273000D3B6FF4BF96DF1E3B4FC567ED95FFC08132030001377507E9D2D7E9C92D9AFD596C374080CC0C4ED97934FF3C5CFD331FF74526D394C87C0004CDFD1D7727777D7BEDC9C955C25C5AC9CDD2CF99C44F97AB4F828980881010008090C004048600000420203001012187A7275BC7C96B0E5C592DB5332E5637B7B7EB8641B9F97E36222BBDD111FEFC7328EF3B4F1F61E5AD9730C0486566ECBF9E1CB13FA436A75DD8725B7FBBC181A5F78BDCD73FA761F2C2D7DCEAB7A75BCFC6FBC2ADD66651BDFB1CD7A7E2E1C846BC05F940F8FDB6A0EDC097A79BEC6C7FBD1CBF374733319B6DCDEEBD372B0F89DD4F6DECFE8F8F47B3FCBC169B5079ABB3E3D78FB19CBCAAE079BBB01D41FFBBAF4EBF26EBEE46FAC2BF3CBC5AF7670395FFED9FD9579F5CD5AB89C2FF9AC35A5F3CEB8B93B9B2DF9DC55A58F9D7F7376375BF6D92B4AF64F8EF6D86664CF8315E5E5BE4B1EEB4D7CCF2124CFAF52667767378BDFDD8AFC3DB051E9E35A5D6A98ED9D050761F8EBFA6DC9EEC2659F31566A181A78AC92CEBD69B6F1F0B63778DAFFF747B7147CFBADFC9D89E717FF74AEF6BEFDF677E28D60567E6D3885DE6E1CDBC55B5B4F5FA29E3B5F15F0783D9CB3CDD64148BBF8507D76BFCD150F355EC36C6FFDE6BFFA9ABA2D3FB6B0EEF9BF3BBC66B9C0B0CEA23A6BF887C94BEB2F82250E7ECD4D3A73FD77F9D6E59CBEF92F559DD77DDDFFDBF22D95501ACCD13F95631BAA57DC3B288D6BA29BBAAF02D6BF615C1E56571CFE9C7D68AEE8E33CADC34DF3669276AEFFBB59FCC4D0048695AA8B33D9CED5A7FAC1D2B84979FFF7F2672E3194BF3B2486AB7FB277AC6E7FAF4A28E5BFCC8108E7E89FD0B15DABAE5918E84DF35E5D2B324018212FB1BA625FBA86DBBA666123817C658D69F2BE41486058E5EA9F8D5E9CCB5C7C68FA86B75F7ECF25860EA9FCAAA4F342E5FAEF6FEDABB893C762F6E7EFEBE7E89FD4B15DEDEAD8C3FC7DD85EC06D1D6EAF8E07AF5960F30486156EB7D1F8F546F586D7F06ADDFF25B9C06FDB7E05B73F4AAB3D73FD5F95F7DBC91D8B59F9F3F7F5ED11533BB64B5537E44D37A7B00D43D722C5F2E1B6DAE6CF63383927BA8AE988090C63D7F4C17EF447C9ADD77751FE69F1BCCA753E7CAEDDDFAB6F3EBDF75F188BD69D41AB374E69E15DB83DFF5F8B5AA4350B63A517D9AA25C3EDD597FC36CFCECACDB2EDBD2F97C97B1B43111856C8BDB1CFCBE5D213FDA9DC9CB58DBA4D1FB447E58FE455D5A637EF4D8746C18B760925372263FE47B527D69BDEB17DE9F6FC73F59BECBCDBF3F2BFE493777E599F93DFCBC9AAD0BC7F52BED7E7ED65F26671F1B9F1C8895C1FA745B8F9BE6EA9EFA3F2F5E7F5B6243CFCF6CB8ADFDD2FD98AD7EEE21ACE49AB0E42EFEA8F7D5DFAB5817918A231EDB3B3BB36C3B05B8D0B6EBAF1D971F8E9EFD0712C759B7D96FC4E8D76D5148FED4FDD8EC1F271EBD9B916D615F330F425773EB5D89EEC776E7671A5CECFF4E9FFD3D339BB762E86F471ED585A7CA1659F335602C34ACBFF46FB13FC49FAC1D2F40196BE389237F7CE175FFEA696DB574DBFCF048FEDA3B6933335FA3BDDC2C84311187A91DC9EB6E7EECDD96CE9E72D2F0D8E6D6ABBB778AE24F76F34415417CBFEDE58699258E9A87C7C56D55C5D90F5512C5FA3FAEE068E3E26DB119B76184C0FAFCC5589B7EFBFF0283BBC323922A34173C483091EDB85FC90D64ADD3EBCB6CAF7D143D56F157AD8B2AB2F895111D5F1FDD8F2DCDD3FF994E81FD0E07E9199A3251CFECCD8080C6BEC9F7CBF7F90F4F530F929FD606F2A3FBC32D3AFA04BFF8547A9E19CC91119F33F9A1FA4E91DDB5A9B21ADF372D9282C3C39FADAA55F06DDE58EF3FC53EEF8BE94EBFBB4CBB318121318B622FB606F3E53E2FEEF7FE6DE701B4F13DD6EFE8537122303869A0E7A58C31DDB36F347CCCE3E36AC7579A90E5442C396A48EF3BC2472F2524789C4D0693E95D7BACE38CBC6090CBB26FB86DBF4A26D3BFFC21BCD9B4152351AB33FCB2E774EAEE5E78F98974F2BBBCBC7EAD0A07962F352C7B97133DC1A99A9E5A326B4D434F5F514D4A61F9F1281614BD2132D35961D4AD4AC5F41F7FE0B4F9A556BE66A34C2D91D376898639B9D8FA2D2C3C3E4E8EB4D51D1B049B9E33CDB78B55A5023B6FF4BC99DFD0F8BB2F533553A4313187650A68AB1D6A45F411FFD171E35AAD64C55CBEEF8D8E77BF979F1337D3A188BA9AF7FD06E76C5FB15527B5E2593FE090CBB283BEB63D8AFA0D9DBFE7CDEF0AF3668064955CBBE83E688BCEE6DDB6C41B2E9AF5EEBA15E9EBD5349AD53715DD6BF5FE43B5E3F795825F37E9B2CAF3E4A02C34ECACEFA18F42B68F4B63F2BBFFED1B4FD32BAE924ABDF57CEF4B643B27D480C599BA6F4D2F1E3931BAAB9C2FDF2EA0FE14173C578080C7DB93A7E99DAA332F05A0007C97AC175FD0A1ABDEDD76FF947CD3B5CAE1FCE99AB961DBCEA7D0CC776071E24BC172FE739E9EAA1B9A22A92C3D6090CADD42BC83D7B400CF590E8203BBC7275BF82666FFB0F9D0E13D591EB9A41363CACECA5F11FDB46DE43ADCB0E1AC74AAADD0D32C2E6E2C3C3F528386C8DC090707B7EB878881CB458416EC3D2C32B570D976AF6B6FFDB6289C8E6230456F7B64ECD66D8C7B0B2CAA48E2D4CC060236CEE83830E92DB203034B1A8923E98D49324DBF968453F86466FFBCFDEF21B77B85C359CF3B6E486A1778C0B933CB6B02D9909D2F6CBC9F7A1A61A7FE820A9B261B30486C0D5F144ABA42BD9F90096F52B68D67FE17907BBE61D2E973683A496B3EE36BBE3948F2D6CC5FCD3EAA5B357A8A71AAF57651B42DDBF4168D81C8161A587B6EC493F4FB2C32BDF4C139DE9BFF0A47187CB65CD20A9C56BDA0EA7DC81630B9B36BF2C776D175E39FA7ABF6ECB10D38D5F7CD03CB12902C30A57C7BBD0969D1C5EF9667E845CFF8547CD3B5CBE6D06C9F45F683BBBE36E1CDB40E3354298B2D9D9CDCF45D4062F3DACD2F673D1B75E6B1CAECBE917D50C9B20302C7375DCE1ED735E2E5F5F68CBCA8626E9CFCDFAF8AA5F41B6FFC2A34487CB97CD2099E9A05BCEEEB843C716266B51E37077D753C7C88BCF6A1936406078E3B69C7FCE3F519E92FED75E7AEDF726D92CF17C9AE87CFF8547890E97CFDF84339313B56A8E98F0B14D2DEA538916096294865B6366AC1E3A46760FDACDD6C4A11B81E1B554A7BBDAAC9CDDDC95EF1D56051C56726EF79FF323B4EBBFF0A8F18DEF5933486681AB56CD11533EB62D16F5593B3716E3940C864DD681998CC75A879BB35C385EE875E96D969A6660E86DA9E5259233EACDCEFE4AF71ADEACB6C32BDBF55FF8293DBC32371DF4CABFBBCEA48F6D7E519F66AB8246A6BE18D2C4648361B80ECC04ED9F94EF6D9A2AD4AA0D4E0DC32BA94983AA47E2A771A7857BD9591FEF1F346DFB2FFC94185E79FF96947930B59BDD71DAC736BB6C791F6F5CF568920F0DCE03FA930D86C172D3935537556443C370FB62A76A723A986460C8545D3FE8365E7FA5A92CF0939CF5B17ED09C3779B806B32C361E5E59BF2565A683EE6976C7B546786CB3EB83D40BF874E93CFE2E46938C4E3618EEF208812E2B5F3284090686E44A8629B95906A7237913BAFEBBFCDDA8BFE3FA476A6678E5E7CFCD777CBBD91DA77F6CDB7488BBF8DC6E99E07A522BF3546C476E6453658747088CA613A861CAF7C611187EAE06781CB7C75D7D69F1D6F35B69D3E43D9C76BDF5BBC80EAFBC0EF77183618D899A8DEBF80F2EF4BDD854DF063CB6D989B86AF532C1A9A9F0EA66086161ABD2C7F9BA9CFEAF5D30ECDF5539BEBF97F73303636E31AE01EFF36FE6A8799F4611189EDA962FCA87FB936DF9CC5DF70B04B5B99335AE5ECEBF89B73989B652D5DBE661B356938B33DFEE1E6ADD54B00BC7363911D7A37AB19E2677EFDBF37268F1AD1168719CEB6078D87768787AF8EF35FDEC674D8B0FCB523778095C29599B9CB937A4471D8D29946DD1DD00EA8F7D5DD6399BBDFDF7BD96F9E5E22FC56ECE66CB3F6355497C76F5E92DBFEBECEEEC66F1111D5CCE977D76CBD2F47B5FCE97FF7ECB32EBB02376E2D876DA9FABFED6E55DF57C5AF2EFDB9479F56913747376375BFA7D56957EAEC9955A1FE7AEDBB5EA3C6EF6B9ABAFB1FC76A5EF571BB95E979FDF4FDB9AFF9E6FFFC6208FE55EBC8B51129936EF749B59F5F676D8A40171046F6FE94E736B44FD177EEAB566A3E5EC8E0B3B716C3BEDCF8715FE1E9AFF9E17232146E7E863CB19109F1DE3866D02F78BB0FD3C17569DC7D7A5DB408167DB15D4563C6E4FB63239D7B7A96DEDE7632DF8CBF2B4AD5DF7D3B8BD83C0906CF36E7143BE3E3DA84E9A15556FF70F93EAA43A38AD4EA5EDCA0EAF5C2DF3E06E598DBE4CEBC5A61676E2D81E958FED9E244CCA7E39F9ABDD04463FD54D51CF1E6AABCAC6FBABD4CD274BB6E3B1B4DB9E7CDFA63E5FA09EEB67FE9371DAFDC0901E82D7F601B73C798E2128FC941C5EB95AAE73515F1766DBC5A69EECC6B1DD3FF9AB9FF9F719B7FD93F29703DDC8ECEC63F23EDFE70BD4FBB1E3816156CE3E664FA3EAB1F2B163B21FAD9EC6352743585F1766ABD91D5FD98D63DBC3DB674A3D45F66587A610DA9A5A38DCCA30C8D959F9ABCD246BBDBD40BD1F3B1D185A4FEDBBB1643F2F671BBE1BF4F1F06EDC7FE1512F17664FC32977E5D8D6D3E76E6455CC3A2C7C1FF9F4E7BBACCD8C875B945D24ADB379B9FC7ED2B2E6B1DAB79FC4E08CDD0D0CF3CB4E8B06D5EBB60F7A3FAE52F1CDDDD7F2FBE23F37263D9CE8B5361D0F7B185ED9E3EC8E3B736C8FBE969B419F24F572DEC2C2F6D5A1E16ED87336D470B6DC2AC86EEE195C9F9F1D5790ADAEA1EDEED769194560E87DFACFFA86FDB5FBE3E5E8EB4017691566EE5AA7E2AE3A76426CD9F1303D7BDD2BED66775C6D578E6D1D7EEA315DBDABBFC7D8966A7FE7EA73769063DD40A6B6B6DECE61836C6511CAFB383F8FBEF65B83D347D3E9682D8657F6AAFED8D765BDFEC6817719A7BF526F7309BC1DA3DB6C6E80AE63AB5F498F397F2AEDF76FDB71CF55999D55BF3D909D39B67D5D43ABB6A7E1E70F79AC8634B6791802556E58B24D03944EC7B3CFF93D9E4A6ABA85847EF6697E1E92659F335623090C0F9ADD605794A1CEA267BA6CDFEACD8B1FA4C37CB5FC03BC8FED48EFC30D1CD7DACE1CDB2127FC091FAA139DB4E9A786D7C49842516F81F759E9FDFB757859F8593614D03ABC4CB53DFF977DD6588D2A303CD7E806BEA187C9520D2ED4416A3B18DE8E1CDB26D7D0362F21FA970FBE9BAF2969BA8D5BBFC61A8687AED7D0B2CF1CABBDFA7FAA0DEC553D46FDB501FE0C004CDA949E97BB3F711300D099C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C00000840406002024300000A1BDBBCAE2E7DEECEDED2D7E02003206782CF7420D0300101218008090C0000084040600203448A7470060B7A861000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000002181010008090C00404860000042020300101218008090C000008404060020243000008152FE1FC0C2101D11A155990000000049454E44AE426082"
    data = bytearray.fromhex(imgbytes)
    print(data)
    qp = QtGui.QPixmap() # create QPixmap object
    qp.loadFromData(data)

    w = QtGui.QWidget()
    w.setWindowTitle("Python Image from Base 64")
    label = QtGui.QLabel(alignment=QtCore.Qt.AlignCenter)
    label.setPixmap(qp)
    lay = QtGui.QVBoxLayout(w)
    lay.addWidget(label)
    w.resize(500, 500)
    w.show()

    sys.exit(app.exec_())

enter image description here

Note: the format is not base64 but is raw data of a PNG.

Ad
source: stackoverflow.com
Ad