Page 1 of 1

Problem saving 16bit TIFF image

Posted: Sun Nov 25, 2007 3:07 pm
by MasA
Hi!

I've got a "Bad format index" message... Here is the code

Code: Select all

    int bits = pow(2,16)-1;
    AnsiString plik = *fname;
    GFL_ERROR error;
    GFL_COLOR color;
    GFL_BITMAP * bmp = gflAllockBitmapEx(GFL_RGB, G[G.High][0].Length, G[G.High][0][0].Length, 16, 3, NULL);

    GFL_SAVE_PARAMS params;
        gflGetDefaultSaveParams(&params);

    for(int x=0; x { G[G.High][0].Length; x++){
        Application->ProcessMessages();
        for(int y=0; y { G[G.High][0][0].Length; y++){
            color.Red = (unsigned short)(G[G.High][0][x][y]*bits);
            color.Green = (unsigned short)(G[G.High][1][x][y]*bits);
            color.Blue = (unsigned short)(G[G.High][2][x][y]*bits);
            gflSetColorAt(bmp, x, y, &color);
            tp->PB->Progress++;
        }
    }

    error = gflSaveBitmap(plik.c_str(), bmp, &params);
    if(error) MessageBox(NULL,gflGetErrorString(error),"Ups...",MB_OK);

    gflFreeBitmap(bmp);
I've change "<" symbol to "{" becouse code got errors when showing on the forum.
------
Where "G" is big Array where I store float numbers (0...1). Where is problem ??

MasA

Re: Problem saving 16bit TIFF image

Posted: Mon Nov 26, 2007 7:09 am
by xnview
You must add params.FormatIndex = ....

Posted: Mon Nov 26, 2007 10:19 am
by MasA
...so simple :)

thx for help.

Great image library !!!

MasA