1
$\begingroup$

I need to produce images of a certain minimum size (1000kb) when written to disk as a jpg file. for images that are not big enough, I am attempting to increase their size to the minimum by increasing the resolution of the picture.

In principal this works, but my script often crashes when attempting to write a bigger and higher resolution file to disk. The line of code in question is this:

bpy.ops.render.render(use_viewport = True, write_still=True)

Here are the results of some tests that I have run:

(a) at 5000x3000 pixels resolution, blender never crashes when trying to create jpg files. When completed, the jpg files are a wide range of sizes (350k - 3000k)

(b) at 9250x5250 pixels resolution, blender frequently crashes but not always. The final output files meet the minimum size requirement (1000kb).

So the problem would appear to be too many pixels in the resolution rather than the final size of the output file.

I have noticed a big spike in RAM usage (4-5GB) while blender creates the higher resolution version of the render. The spike is big enough to slow the entire computer down.

I don't know how to fix this. I would appreciate any suggestions. Thanks in advance!

$\endgroup$
1
  • $\begingroup$ Looks like you're running out of memory and the OOM killer terminates Blender. Is there a specific reason why it has to be jpeg and rendered with Blender? Perhaps this is a XY problem. $\endgroup$ – Robert Gützkow Nov 22 '19 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.