use crop tool with Delete Cropped Pixels selected to crop the image. You have an unmasked area or something visible on a layer somewhere outside the canvas area.
Ok, I tried it again, and the export was the same. However, then I hid and re-showed the layers, and export was correct. It's definitely some kind of bug.
Can confirm this bug has been in Photoshop for as long as the new export feature has been implemented, and they phased out "save for web". Have you noticed that export sometimes won't let you export at the size you want? you have, say, a 600x400 image, cropped to 600x400, and you go to export it...and what's this, Photoshop? You have to export to 599x400? Um, well, ok. And then you export and load it up on whatever project to find you now have extra pixels. That product image that you thought was on a pure white background? Yeah, now there's an ugly black line. You look like a f***ing crap photographer who can't even edit shots. Thanks Adobe. Glad your team is hard at work providing digital marketing reports, because that's what I really want from you, not software that works.
So why does this happen? My best guess is the algorithm isn't using floating point precision in its calculations. Maybe whoever coded it used Int or Float for the numerical calculations. Who knows. All I know for sure is that 80% of my photos that look fine on export secretly have a 1px line extra pixels that SHOULD HAVE BEEN CROPPED TO MY CANVAS.
No, I shouldn't have to delete cropped pixels in an effort to trick the exporter. Sometimes I have data I need to save outside of the canvas, I don't want to have to delete. Save for web admittedly doesn't have the nice compression that the export does, but it WILL let you export at the right dimensions and it WON'T add more pixels.
Photoshop export is broken, and has been ever since it replaced "save for web".
A disturbingly majority of the time, when exporting an image, it will disregard canvas bounds. Sometimes this will mean including areas outside the canvas, if pixels exist outside and have not been cropped and deleted - which is not always convenient (say if you are wanting a large background image that you may wish to move to create other media, and not permanently crop).
Often these are only 1px wide, and aren't noticeable in thumbnails, so you think the file had exported correctly, and you check it, and in windows photo viewer it's framed on black so if your image has a white background, like 90% of product images, you can't see it, until it gets uploaded to the client website on a white background and there's suddenly a GLARING line on one edge or partly on one edge of a picture.Putting a white fill around the edge does not fix the issue - as it's adding pixels outside the canvas bounds. The only workaround is to increase the canvas bounds, add white, and then re-crop the image. This is unacceptable - the exporter should export the canvas area, and the canvas area alone.
When exporting to specific sizes, it will randomly fail to export to the requested size, demanding '599px' instead of '600px', for example. Save for web never had this issue, and still doesn't.
I suspect the two issues are related - and I suspect it may have something to do with the calculations not using long/floating point precision so that the calculations are flawed.
The exporter is broken, and has been since it was introduced.
While you're right in that I can still use save for web, Adobe states that it was too old to maintain and that 'Export As' functionality was far better - and it's right, for the most part. It's a far better export tool with advanced algorithms that blow other imaging software out of the water - WHEN IT WORKS. However, it doesn't always work - it's broken, and has been since it was rolled out. What I'm complaining about is that issues haven't been fixed. The extra pixel adding and forced size changes for whatever reason are far more than a minor annoyance. If any other piece of software performed like this there would be outrage and refunds.