Python not taking picture at highest resolution from Raspberry Pi Camera
<p>I have a Raspberry Pi Camera version v2.1, capable of taking a picture with 3280x2464 resolution.</p>

<p>I have taken a test with raspistill command, and this seems to work out fine:</p>

<pre><code>raspistill -o 8mp.png -w 3280 -h 2464
</code></pre>

<p>returns the info:</p>

<pre><code>8mp.png JPEG 3280x2464 3280x2464+0+0 8-bit sRGB 4.524MB 0.010u 0:00.010
</code></pre>

<p>However, when I use the Python code to take a picture, it will refuse it. Here's the code I'm working with:</p>

<pre><code>#!/usr/bin/python
import picamera

camera = picamera.PiCamera()
camera.resolution = (3280,2464)
camera.capture("test.png")
camera.close()
</code></pre>

<p>And this is the error:</p>

<pre><code>mmal: mmal_vc_port_enable: failed to enable port vc.ril.image_encode:out:0(PNG ): ENOSPC
mmal: mmal_port_enable: failed to enable port vc.ril.image_encode:out:0(PNG )(0x700090) (ENOSPC)
Traceback (most recent call last):
  File "pic.py", line 6, in &lt;module&gt;
    camera.capture("test.png")
  File "/usr/local/lib/python2.7/dist-packages/picamera/camera.py", line 1383, in capture
    encoder.start(output)
  File "/usr/local/lib/python2.7/dist-packages/picamera/encoders.py", line 1024, in start
    super(PiCookedOneImageEncoder, self).start(output)
  File "/usr/local/lib/python2.7/dist-packages/picamera/encoders.py", line 394, in start
    self.output_port.enable(self._callback)
  File "/usr/local/lib/python2.7/dist-packages/picamera/mmalobj.py", line 813, in enable
    prefix="Unable to enable port %s" % self.name)
  File "/usr/local/lib/python2.7/dist-packages/picamera/exc.py", line 157, in mmal_check
    raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Unable to enable port vc.ril.image_encode:out:0(PNG ): Out of resources (other than memory)
</code></pre>

<p>I have noticed doing it with .jpg instead of .png will work. This seems a little odd to me, as the documentation says it should work, and the raspistill command also works with this resolution on .png.</p>

<p>Any ideas?</p>

<p>I ran into the same problem. I was able to solve it by adjusting the Pi's "Memory Split" setting to 256MB. This changes how much memory is available to the GPU. </p>

<p>You can access this setting by running <code>sudo raspi-config</code>. "Memory Split" is under "Advanced Options".</p>

python camera raspberry-pi