The command I have been using is
convert $sourceImage -resize x450 -gravity center -background $colorCode -extent 500x631 $targetImage;
where the colorCode is #19191B.
This works perfectly for 95% cases but for few, the background color starts to deviate from the one mentioned.
Like to #1A1A1C.
sample image
I have tried setting colorspace but nothing seems to work.
Can anyone help.