Both cameras have 1/3" sensors, but LG's has more than three times the number of pixels. HTC claims the bigger pixels do better in low lighting conditions, but the company has done nothing to improve the sensor since 2013. If anything, it made things worse by removing the optical image stabilization.
The LG G3 does have stabilization, the OIS+ tech LG used on the G Pro 2. The camera doesn't have a large, new generation sensor like the Samsung Galaxy S5 or the Sony Xperia Z2, but it should be able to knock the One (M8) on its back regardless.
LG has added something dubbed Laser autofocus - it uses infrared light instead of actual lasers but promises blazing fast autofocus. It works with traditional contrast autofocus and with phase detect autofocus.
HTC doesn't have that, instead it makes use of a second camera that allows it to create shallow depth of field effects with some artistic options and change the focus point after the fact. Virtually all Android cameras can do shallow depth of field thanks to an official Google camera, but LG has its own implementation that can also change the focus point.
Here's the difference - since the HTC One (M8) has two cameras, it only needs a single shot to do what it does. The Google camera needs two, while the LG G3 takes several photos. This makes the One (M8) suitable for action shots (the subject will move between shots with the other cameras).
Also, you can do the effect on any photo while with the other cameras you can only refocus or do shallow DoF if you've shot the photo in the special mode.
A more interesting option lets the HTC One (M8) user control all available settings manually - focus point, shutter speed, ISO, exposure compensation and white balance. You can have every control you need overlaid over the viewfinder (including all controls) so you can feel like a pro when setting up a shot.
Of course you're limited by what the hardware can do, but it's an interesting option nonetheless (similar to the custom camera app Nokia made for its Lumia phones).
Before we go on to image quality, we'll make a note of the field of view (FoV) of both cameras. HTC uses a widescreen sensor, meaning the entire shot fits snugly on the phone's screen and on an HDTV. LG uses a traditional 4:3 sensor, meaning you'll have to settle for black bars or cropping on both the phone's screen and on a TV.
The HTC One (M8) camera has a wider FoV to go with its widescreen format - it's a bit narrower vertically, but it can fit a lot more into the shot horizontally.
The LG G3 has over three times the number of pixels the HTC One (M8) has, which makes direct comparison more difficult. We tried upscaling the HTC photos to 13MP and downscaling the LG G3 photos to 4MP to put both on even footing.
Even after the downscale, it's obvious the LG G3 has more per-pixel detail than the HTC One (M8), the upscaled shots just make it much easier to see. Keep in mind that an UHD TV has an 8MP screen, while a WXGA tablet has around 4MP.
Color rendering isn't perfect on either phone, the LG seems to struggle with the reds, while the green is oversaturated. The HTC One (M8) photo is on the dark side (even though it was taken on a bright sunny day), which skews the colors and they are off the mark too.
This first crop also shows a good deal of issues for the One (M8) camera - the shadows are underdeveloped and there's noticeable purple fringing.
The next crop is just downscaled to 4MP as we're looking at the difference in highlight and shadow rendering on both phones. The HTC One (M8) preserves more detail in the very bright white clouds, but the shadowed areas of the building are too dark to make out.
The LG G3 meanwhile captured less of the cloud but there's some visible detail in the shadows. Despite the even resolution, the thin vertical bars of the railing on the building (top half of the crop) are clearly visible in the G3 photo and nearly lost to artifacts in the One (M8) photo. There's a noticeable difference in sharpness in the signs and foliage too.
Let's go back to the purple fringing as it's some of the strongest we've ever seen. We downscaled the LG G3 photos to 4MP so the crops show the same parts of the image. The light, reflective areas show a strong purple color in the HTC One (M8) photo, while the G3 photos are unaffected. This speaks poorly of the lens HTC used.
You can view the full size photos we used to make the crops, along with more shots to do your own comparison:
Our Photo Quality Comparison tool lets you view crops too and you can move around the entire image. There's a scaling option so you can view photos at their native resolution, down or upscale them. The first chart showcases an issue of the HTC image processing where finer detail is plagued by moire patterns - we've seen this effect in real-life photos too.
The second chart features squares, each painted in two colors with very subtle contrast between the two areas. The HTC One (M8) comfortably resolves the lighter squares, but the darker ones become uniform. The LG G3 is the opposite - as we saw with the second crop it pays more attention to the shadows, at the cost of highlights.
The third chart is interesting for its many colors and the HTC camera once again produces a darker image, skewing the colors. Its white balance under the artificial lighting is blueish too. The second chart is shot using natural lighting and it shows a slight yellow tint from the LG G3.
Winner: LG G3. The G3 camera is not perfect, but it's leagues ahead of the HTC One (M8) camera.
HTC have released a flagship with camera issues commonly associated with lower-end phones - we know the UltraPixel camera stacks up poorly in daylight shots, but the processing needs tuning and the purple fringing means the One (M8) never stood a chance.