Please nominate your Qt Champions for 2021!

[SOLVED] Help in Creating Indexed8 image from a buffer

  • Hi,

    I am having trouble creating image of the format Indexed8 from a buffer that I have code is as follows:-

    @my_buffer= (uchar*)malloc(xy);

    img= new QImage(my_buffer,x,y,QImage::Format_Indexed8);

    for(int i=0;i<256;i++)

    scene = new QGraphicsScene;
    item= new QGraphicsPixmapItem(pix);
    view=new QGraphicsView(scene);

    When I execute this piece of code I can just see a black image. Can someone please help me out what am I doing wrong? here colors is a QVector.

  • oh no my code lost all its formatting...its not even readable now!!

  • [quote author="xenonforlife" date="1334582807"]oh no my code lost all its formatting...its not even readable now!!

    hit the edit link on the right of it and add the @-tags, that adds formatting to your code.

  • I have updated the code so that it is more readable...I hope someone can help me!!

  • If you had removed the whitespace on the beginning of the lines it would be even more readable...

  • That too is done now...hope someone knows about this issue!!

  • figured it out on my own. Thanks

  • Moderators

    What was the solution? (In case others with the same issue read this thread in the future.)

Log in to reply