Updated by Andrey Kamaev over 12 years ago

as discussed here: http://stackoverflow.com/questions/10410521/opencv-python-save-jpg-specifying-quality-gives-systemerror

<pre><code class="python">
cv2.imwrite('img_CV2_90.jpg',
@cv2.imwrite('img_CV2_90.jpg', a, [cv2.IMWRITE_JPEG_QUALITY, 90])
</code></pre>

90])@

fails with exception:

<pre>
Traceback
@Traceback (most recent call last):
File "<input>", line 1, in <module>
SystemError: error return without exception set
@


</pre>

This works (when @cv2.IMWRITE_JPEG_QUALITY@ cv2.IMWRITE_JPEG_QUALITY is converter from @long@ to @int@ ):

<pre><code class="python">
cv2.imwrite('img_CV2_90.jpg',
@cv2.imwrite('img_CV2_90.jpg', a, [int(cv2.IMWRITE_JPEG_QUALITY), 90])
</code></pre>
90])@

Back