I thought about having local storage for the images where images are stored after getting them from the API
You could check the Download images part of this Image doc : https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=macos#download-images
And in the source code, we can see the image has been downloaded and been written in
ImageLoaderCache folder. You could refer to this solution and store the image in the path you want to store. Pay attention to replacing Device.PlatformServices.GetUserStoreForApplication(); by Xamarin.Essentials: File System Helpers.
I mean not accessible by anyone or any other app other than ours.
For iOS, the Application Sandbox rule is secure. It cannot access another application’s files, these files also cannot be accessed by other applications unless you share the files by Files App. For more details, refer to File system access in Xamarin.iOS.
For Android, if you are using Internal Storage, it is secure. The files can be accessed only by the application or the operating system. For more details, refer to File Storage and Access with Xamarin.Android.
Can I just store them as files, or would I need to use a database?
You can store the file, and name each image with the user ID or other fields or other rules that you can query, which is convenient when reading from a path. It's not very necessary to use a database to store the image, because the image size is a little big. Usually, we use SQLite as the Local Database, it's small and lightweight. But you could save the path or URL or some other user information by database, it depends on your needs.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.