Camera - how to best size it on mobile phones for good detail

d11, fmx, win7, android 12, camera and barcodedecoder and database (unfinished sqlite)

I am building a small barcode scanner on a mobile device, which includes, for now, a FDMemTable and StringGrid to store all my scanning data.., (barcodes, type, date, isle, row, and so on.), later to build/incorporate sqlite as the main database.

So my problem is how to obtain the best dimensions for the camera while still keeping the data grid showing mostly. I don't want to have a full-screen camera to scan barcodes, as I found out that it uses more battery life. So I reduce the size to small enough to scan barcodes.

However, making the camera window smaller causes the quality to diminish and I can't see the barcode details, nor to make it maneuverable to help with focusing on the barcode to get the best scan possible. It basically looks blurry.

I've seen other barcode scanners that have a small window (like mine) and also display a square in the center of the camera's view so that just that portion of the image gets analyzed for barcode decoding, hence helping with battery life. But my point is, that those barcode scanners (they are all mobile devices on smartphones, etc) look great. I can make out the barcode quite well.

My question is how can I simulate the same for my project while using fnc's camera component?

Here is a sample screenshot (image_no 011) I made from my app.

This is on my galaxy s10+ phone w/ android 12

Normally, the camera windows is very small with large white spaces on the left/right sides.
What I did was "pinch" it larger and then centered the image with my finger.

Below the barcode in the image posted, you can see the grid. This is the way i'd like to have it when scanning barcodes.

But as you can see, the image is still blurry or fuzzy. I set the resolution down to 240h by 320w. I think it helps to size it properly. But I don't know if that's a good idea. If I resize the image, then when the app loads, its still the same size at startup. I have to use my fingers to pinch the image larger or smaller. And the larger you make initially set the resolution in code, the slower the scanning becomes or lagging, though (the lagging) is not a big issue here, its not that noticeable.

Just so you know, in the image above, I resized it by pinching it and then centered it in the window to make it look the way it does in that image. Normally, the image is very small with large white borders on both left/right sides at the apps start up. I have other ideas to add to this project but may describe it later if I need help.


The camera component is keeping the ratio from the camera and displays everything from the camera feed. There is no workaround for this in the current version.

We were unable to pinch zoom on the camera, so we could not test this but zooming onto something that is already low resolution can end up being blurry.

However we did some quick tests to see if this is possible to do at all and we ended up adding a KeepRatio property. When KeepRatio is set to False, the camera feed will fill the available control space.

Please check your private messages for an incremental source update and see if this feature is what you are looking for.