0
$\begingroup$

My script seems to be taking a very long time to write to disk a .jpg file. The output should be about 1.5-2.0mb in size and shouldn't take more than a minute or two to write to disk.

Monitoring task manager, I notice Blender doing the following:

(a) before printing, Blender uses 40-50% of the CPU and about 1GB of RAM

(b) once printing starts, CPU usage drops to <1% and RAM balloons to 5GB.

Suggestions?


def Print_image(outputfilepath,outputformat):

    for area in bpy.context.screen.areas: 
        if area.type == 'VIEW_3D':
            space = area.spaces.active
            space.shading.type = 'RENDERED'
    bpy.context.scene.render.image_settings.file_format=outputformat
    bpy.context.scene.render.filepath = outputfilepath
    bpy.ops.render.render(use_viewport = True, write_still=True)
```
$\endgroup$
3
  • $\begingroup$ Please show your code or at least what API calls you use. $\endgroup$
    – Robert Gützkow
    Sep 13, 2019 at 16:02
  • $\begingroup$ @rjg code has been added to the original question. $\endgroup$
    – vndep
    Sep 13, 2019 at 16:11
  • 1
    $\begingroup$ Just to say, the more correct term is 'rendering' not 'printing'. $\endgroup$ Sep 13, 2019 at 16:41

3 Answers 3

1
$\begingroup$

It takes long because you're rendering the image using bpy.ops.render.render, not just saving an existing image as .jpeg.

$\endgroup$
2
  • $\begingroup$ What's a more efficient way to do it? $\endgroup$
    – vndep
    Sep 13, 2019 at 16:20
  • 1
    $\begingroup$ @vndep Before I can answer that, the question is what are you trying to do? Do you want to save an existing image, e.g. a texture or an already completed render to disk? Do you want to start rendering and then save the result (that's what your script currently does)? $\endgroup$
    – Robert Gützkow
    Sep 13, 2019 at 16:22
1
$\begingroup$

I'm not sure if this will help, but I have a very slow computer and have also had trouble with rendering. If nothing else works, check out this link to BlenderGrid. I gotta say they're pretty nice! They have pretty cheap prices too. https://blendergrid.com?aff=ovwnhtzt

$\endgroup$
0
$\begingroup$

It turns out that the problem was in the python script.

Specifically, the camera's positioning was determined algorithmically and - in this case - was 200m from the object. Consequently, blender spent a lot of time attempting to draw a huge field of view.

Reducing the distance to a maximum of 20m (and then adjusting the focal length to get the correct framing of the area of interest) solved the problem.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .