Problem saving 16bit TIFF image

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: helmut, XnTriq, xnview

Post Reply
MasA
Posts: 2
Joined: Sun Nov 25, 2007 2:41 pm

Problem saving 16bit TIFF image

Post 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
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Problem saving 16bit TIFF image

Post by xnview »

You must add params.FormatIndex = ....
Pierre.
MasA
Posts: 2
Joined: Sun Nov 25, 2007 2:41 pm

Post by MasA »

...so simple :)

thx for help.

Great image library !!!

MasA
Post Reply