Is there any way to save the part beyond the canvas by canvas to save the picture?

question:
when I save a picture, I get the width and height of the canvas, but this is not what I want, because the part beyond the canvas will be cut off when it is saved as a picture, how to get the true height and width of the object?

Jun.28,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eacdab-210c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eacdab-210c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?