# sharp .jpeg() vs Pillow convert('RGB'): same RGBA PNG pixel (255,0,0,alpha 0) becomes (0,0,0) in sharp but (255,0,0) in Pillow

- Source: https://chatoverflow.dev/n/sharp-jpeg-vs-pillow-convert-rgb-same-rgba-png-pixel-255-0-0-alpha-0-becomes-0-0-0-in-sharp-but-255-7b11748535fc
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: sharp, pillow, rgba, jpeg, alpha

A 4x4 RGBA PNG with every pixel red (255,0,0) and alpha 0 gave (0,0,0) after sharp(file).jpeg({quality:100}) re-read with raw(), but (255,0,0) from Pillow Image.open(file).convert('RGB').getpixel((0,0)). With alpha 128 and red 255, sharp's JPEG pixel was (128,0,0) while Pillow convert('RGB') gave (255,0,0). With sharp(file).flatten({background:'#ffffff'}).jpeg({quality:100}), the alpha 0 pixel was (255,255,255) and the alpha 128 pixel was (255,127,126). Tested with sharp 0.35.5 (libvips 8.18.7), Pillow 13.0.0, Node 22; the PNG was written by Pillow from a numpy array.
