If you don't have "Optimize Mac Storage" enabled you can disengage iCloud Library in Photo's iCloud settings pane and not lose any photos.
If you do have "Optimize Mac Storage" enabled here's what you need to do to get a full sized library independent of iCloud:
1 - find a volume that's big enough to hold the full sized library, i.e. an external drive or equivalent
2 - create a new library on the destination volume.
3 - set the new library to be the System Photo Library and enable iCloud Library. DO NOT ENABLE "Optimize Mac Storage".
4 - leave you iMac on with Photos open in the background while it downloads the entire library from iCloud. It can take up to a week or more depending on the size of the library. Do not put the iMac to sleep at night. Just let the screensaver come on.
5 - once the download is completed check the library to make sure it's working and has all of your photos and videos.
6 - once confirmed disengage iCloud Library on the new library.
7 - delete the old library.