[Python] Issue with 1st pixel of newly created image

Discussão em 'Python' iniciado por Stack, Fevereiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I am making new image which has stretched gradient on its edge based on two pixel colors in images A and B, but it doesn't happen unlike with all of the other pixels.

    I am using code which is pasted below

    ca = pix[x6,y0]
    cb = pix2[x3,y0]
    norm = round(gg0*3)

    if ca[0] < 127 and cb[2] > 126:
    pix2[x0,y0] = round(cb[0] - norm), round(cb[1] - norm), round(cb[2] - norm)

    gg0 = (abs(g0/6)) and g0 = ca[0] - cb[0]


    1st bit of IF statement or ca[0] value in this case is 0, and 2nd cb[2] value is 232.

    I didn't had a problem with any other pixels and could manipulate their values through these code line ways but not that pix2[x0,y0]...

    gg0 value is 39, so gg0*3 = 117 and the pixel is not getting even darker.

    To add, this is code for making 2nd image that the script is making while I had absolutely no problem with the 1st image.

    Anyone has any idea what is wrong?

    By the way, as the last step in order to make a post with question - i had to answer "What have you tried and what you are expecting" thing - in which i wrote what's below.

    Can't see a reason to try anything else so or as far due to my coding skills/knowledge is not that big yet to use a different method to achieve what i intended, while the python console slapped me with no error while all of the rest of the statements worked perfectly fine. Apart from that, i am very satisfied with what this code result does apart from that one pixel. Expecting that someone could explain me what went wrong or maybe suggest me a different way of writing this.

    Continue reading...

Compartilhe esta Página