Canon 50mm f/1.8 STM or Nikon 50mm f/1.8g for image quality and bokeh?
I want to buy a new DSLR. I will buy a 50mm lens along with it. I'm confused between these two lens. My DSLR brand will depend upon the lens which produces better quality pics with awesome bokeh.
Sadly there's NO way to know if a specific lens produces Bokeh, a pleasing out of focus area behind a subject without doing actual tests.
Image quality it going to be the same with either lens.
All you can do is maybe visit a proper camera shot which has both lenses in stock and run some tests using your own memory card and then view the results at home using your large computer monitor. Trying to decide which has the best looking out of focus area behind a subject using the tiny LCD screens on a camera is NOT going to show you much
Let me clue you in on something. When people look at a photo, the first thought that comes into their head is not the background. The exception would be if the shot was so poorly composed that the subject wasn't obvious. Since both lenses have the same aperture range, either one will blur the background equally well as long as the subject is far enough away from the background and you picked the appropriate aperture.
Or the Sigma f1.4 art
Six of one, half a dozen of the other. You won't be able to tell the difference between the two.
The Nikon…
The Japanese can't explain Bokeh, and they invented it, the closest is, "I can't focus for toffee, so here's an arty image."
If you can only see Canon and Nikon, you have no business owning a DSLR in any case.
Whatever lens and camera you get, you will produce the same picture because picture quality depends on you. The camera and lens are only tools.
If you go for Nikon, take note that with their entry-level cameras (D3x00 and D5x00), you can only autofocus with lenses with a built-in AF motor (Nikon AF-S or AF-I specs).
If you decide to buy a crop-sensor dSLR, get it with the kit lens. 50mm will be short-telephoto with the camera and you will find it too limiting to shoot a variety of photos. The kit lens will avoid that problem. In case you didn't know it yet, you can also get great quality shots and bokeh with the kit lens if you know exactly what you are doing.
Just a warning, since you're just about to buy a dslr, it is probably a crop sensor, so that 50mm will be more like the equivalent of an 85mm, which has a pretty narrow field of view. It's great for portraits where you want to photograph primarily the head and face, but if you want the look of the famous 50mm lens a 35mm lens will give about that proper field of view.
You didn't mention the price range. That would help us make better recommendations and suggestions.
Both of those lenses you mentioned will yield images and you won't be able to tell the difference what CAMERA was used.
When you say, "50mm lens," are you referring to the 50mm lens used with 35mm film cameras? IF SO, then consider this: are you buying a FF digital camera? If so, then your use of "50mm" lens is understandable but if you're getting a crop sensored camera, you may not be happy since it will SEEM more like an 85mm lens (in 35mm film camera terms), so you'll need a 35mm DX lens for the crop sensored camera to get the same "50mm film lens" effect.
A 50mm lens (during the film era, before digital photography and the crop sensor cameras popular today) was the lens that came with the camera, used for everyday, walking-around purposes, often used by amateurs and photography enthusiasts for single-subject and "group" portraits, too. IF that is what you want, and you're buying a crop sensor camera, you need a 35mm DX lens to replicate the film-era 50mm lens effect. Otherwise, as you'll discover, the 50mm lens on a DX camera will yield an effect like an 85mm lens, great for head shots and half-body portraits but not really that great for street photography (or walk-around purposes). And depending on the camera model you get, you may have to consult with the camera shop clerk to ensure it will autofocus because some camera models have built-in AF mechanism while some do not and require a lens with its own built-in AF mechanism).
Insofar as camera brand, it will ALSO depend on the camera model and its ergonomics, how comfortable YOU feel while handling it. I recommend and suggest that you go to a camera shop and try out several camera brands and models in the price range you're interested in. Buying a camera today is an expensive endeavor, or investment. Try Canon, Nikon and Pentax camera models in the same general price range; they're all good and have relatively good lenses available you may later want to own for other effects and greater versatility they will offer you.
Personally, I'd recommend a kit zoom lens. It is relatively inexpensive and will give you a lot of versatility and different perspectives for many areas of shooting (single/group portraits, street photography, landscape, nature, etc) and kit zoom lenses also have the 35mm and 50mm focal ranges for you to use as the need arises.