python - Preserve color with PIL when copy image -


i have code

# creating qr img = none img_io = stringio.stringio()  img = qrcode.make('http://my-domain.com/scanned/'+str(s.pk)) img_w, img_h = img.size  logo = image.open(settings.media_root+'logo.png', 'r') logo_w, logo_h = logo.size  offset = ((img_w - logo_w) / 2, (img_h - logo_h) / 2) img.paste(logo, offset)  img.save(img_io) qr_code = inmemoryuploadedfile(img_io, none, 'the-qr.jpg', 'image/jpeg', img_io.len, none) 

the image 'logo.png' red color, when save final image in black , white, how can preserve rgb colours?

i have tried raises errors:

img.convert('rgb').save(img_io)   file "/var/www/project/api/views.py", line 361, in perform_update     img.convert('rgb').save(img_io)   file "/usr/local/lib/python2.7/dist-packages/pil/image.py", line 1687, in save     format = extension[ext] keyerror: '' 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -