Page MenuHome

bpy.types.Image.scale is limited to 10000px while render can be up to 65536px
Closed, InvalidPublic


System Information
Operating system: Darwin-16.7.0-x86_64-i386-64bit 64 Bits
Graphics card:

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: rBf6cb5f54494e
Worked: never?

Short description of error
bpy.types.Image.scale is limited to 10000px (also stated in docs) while render can be up to 65536px, overlook from older days? when supplied image is 10001px, result is distorted image, skewed.

edit: i am using offscreen gpu render, i tried to render 10002x600 and resized to 5001x300 result is with described problem

Exact steps for others to reproduce the error
[Please describe the exact steps needed to reproduce the issue]
[Based on the default startup or an attached .blend file (as simple as possible)]



Event Timeline

Campbell Barton (campbellbarton) closed this task as Invalid.EditedOct 15 2019, 1:15 AM

This is a soft limit, just like "New Image", you can type in larger values.

i have to disagree, i’m afraid. i’ll make an example to demonstrate the image distortion in result

Tested this and scaling over 10,000 it works as I'd expect, please show an example where this doesn't work as expected.

import bpy
import gpu
import bgl
from mathutils import Matrix
from gpu_extras.presets import draw_circle_2d

width = height = 10001

offscreen = gpu.types.GPUOffScreen(width, height)

with offscreen.bind():
    amount = 10
    for i in range(-amount, amount + 1):
        x_pos = i / amount
        draw_circle_2d((x_pos, 0.0), (1, 0, 0, 1), 0.5, 200)
    buffer = bgl.Buffer(bgl.GL_BYTE, width * height * 4)
    bgl.glReadPixels(0, 0, width, height, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)

image_name = "output", width, height)
image =[image_name]
image.scale(9000, 9000)
image.pixels = [v / 255 for v in buffer]

and result with 10000 and 10001 sizes, a bit brightened to be visible

eh, i have it wrong, i run scale before pixels are assigned, swapping last two lines fixes it. i'm sorry, i'm stupid..