Picamera2 can't get same picture as libcamera

  1. Where did you get the camera module(s)?
  2. Model number of the product(s)?
    64MP Hawk-eye autofocus
  3. What hardware/platform were you working on?
    Raspberry Pi 4 8GB Bullseye
  4. Instructions you have followed. (link/manual/etc.)
    Picamera documentation
  5. Problems you were having?

calling “libcamera-still -t 0 --autofocus” from the command line gets a very nice picture that I want. However, when I call picam2.create_still_configuration() from the code, the picture gets cropped out and I cannot see the edges

I did a little digging and found out that libcamera is using sensor_mode[4], so I used:

camera_config = picam2.create_preview_configuration(raw=picam2.sensor_modes[4])

But I got an error saying it failed to allocate buffers. I have cma set to 512 and I added alloc_in_cma_threshold=16, but I still get the error.

I literally just want to get the same picture from libcamera and save it…

  1. The dmesg log from your hardware?


  1. Troubleshooting attempts you’ve made?


  1. What help do you need?

How to get libcamera picture through picamera2


I see you discuss it in other threads as well, I am replying in this thread.

As described in another post, there are still some problems with the Raspberry Pi, which prevents the 64mp maximum resolution from being saved. We are also actively exploring whether there are more solutions. This is not a short-term work, if this confuses you I’m sorry for that.

At present, you can save the second largest resolution. This problem cannot exist forever. You can look forward to subsequent improvements together.

camera_config = picam2.create_preview_configuration(raw=picam2.sensor_modes[3])