[FIX] tools: prevent crashes with Pillow >= 4.2.0
[FIX] tools: prevent crashes with Pillow >= 4.2.0

From Pillow 4.2, it is forbidden to save RGBA images as JPEG
( https://github.com/python-pillow/Pillow/commit/e4d6223c944cf44c468cc65a560b94dfcf351a62 )

A crash was occurring when loading demo JPGs as
image_resize_and_sharpen() was silently changing image mode to RGBA.
Now we ensure that we return the original image mode.

We also avoid crashes when converting from PNG to JPG

Nowheresly/odoo,synconics/odoo,OpenUpgrade/OpenUpgrade,funkring/fdoo,OpenUpgrade/OpenUpgrade,alexcuellar/odoo,vnsofthe/odoo,odootr/odoo,Elico-Corp/odoo_OCB,tvibliani/odoo,tvibliani/odoo,NeovaHealth/odoo,glovebx/odoo,alexcuellar/odoo,datenbetrieb/odoo,synconics/odoo,odootr/odoo,funkring/fdoo,OpenUpgrade/OpenUpgrade,diagramsoftware/odoo,synconics/odoo,Nowheresly/odoo,Nowheresly/odoo,datenbetrieb/odoo,NeovaHealth/odoo,CatsAndDogsbvba/odoo,Elico-Corp/odoo_OCB,odootr/odoo,glovebx/odoo,Nowheresly/odoo,funkring/fdoo,vnsofthe/odoo,odootr/odoo,CatsAndDogsbvba/odoo,CatsAndDogsbvba/odoo,ygol/odoo,datenbetrieb/odoo,diagramsoftware/odoo,spadae22/odoo,NeovaHealth/odoo,Elico-Corp/odoo_OCB,datenbetrieb/odoo,alexcuellar/odoo,vnsofthe/odoo,diagramsoftware/odoo,tvibliani/odoo,OpenUpgrade/OpenUpgrade,CatsAndDogsbvba/odoo,tvibliani/odoo,diagramsoftware/odoo,odootr/odoo,alexcuellar/odoo,vnsofthe/odoo,vnsofthe/odoo,spadae22/odoo,funkring/fdoo,Elico-Corp/odoo_OCB,odootr/odoo,spadae22/odoo,CatsAndDogsbvba/odoo,Elico-Corp/odoo_OCB,OpenUpgrade/OpenUpgrade,Nowheresly/odoo,synconics/odoo,alexcuellar/odoo,synconics/odoo,spadae22/odoo,alexcuellar/odoo,glovebx/odoo,tvibliani/odoo,ygol/odoo,diagramsoftware/odoo,datenbetrieb/odoo,spadae22/odoo,synconics/odoo,NeovaHealth/odoo,ygol/odoo,vnsofthe/odoo,diagramsoftware/odoo,glovebx/odoo,diagramsoftware/odoo,spadae22/odoo,NeovaHealth/odoo,OpenUpgrade/OpenUpgrade,ygol/odoo,NeovaHealth/odoo,CatsAndDogsbvba/odoo,glovebx/odoo,alexcuellar/odoo,glovebx/odoo,funkring/fdoo,tvibliani/odoo,funkring/fdoo,spadae22/odoo,CatsAndDogsbvba/odoo,NeovaHealth/odoo,Elico-Corp/odoo_OCB,Nowheresly/odoo,Nowheresly/odoo,synconics/odoo,OpenUpgrade/OpenUpgrade,glovebx/odoo,datenbetrieb/odoo,tvibliani/odoo,ygol/odoo,datenbetrieb/odoo,funkring/fdoo,odootr/odoo,ygol/odoo,vnsofthe/odoo,ygol/odoo