Problem with gflBitmapSetIPTC and GFL 2.40

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

Moderators: XnTriq, helmut, xnview

User avatar
Ithier
Posts: 47
Joined: Fri Nov 19, 2004 10:50 am
Location: Paris, France

Problem with gflBitmapSetIPTC and GFL 2.40

Post by Ithier »

Hi,

I have tested the gflBitmapSetIPTC function and have a problem. When I save the image after I have added some iptc data and saved them in the GFL_BITMAP structure with the gflBitmapSetIPTC then the application crash when I call gflSaveBitmap. I have tested it with VC++ and dev-cpp (g++) and have the same problem. But it is very strange because when I use my debugger with dev-cpp, then it doesn't crash anymore !!

Here is the code to reproduce the problem:

Code: Select all

#include "libgfl.h"

int main(int argc, char *argv[])
{
	gflLibraryInit();

	GFL_LOAD_PARAMS load_option;
	gflGetDefaultLoadParams( &load_option );
    GFL_FILE_INFORMATION    GflFI;
    GFL_BITMAP*     GflBitmap;
	gflLoadBitmap(argv[1], &GflBitmap, &load_option, &GflFI);

    //Add iptc Data
    GFL_IPTC_DATA* iptc = gflNewIPTC();
    gflSetIPTCValue(iptc, GFL_IPTC_BYLINE, "moi");
    gflBitmapSetIPTC(GflBitmap, iptc);

   	GFL_SAVE_PARAMS save_option;
    gflGetDefaultSaveParams(&save_option);
    save_option.FormatIndex = gflGetFormatIndexByName("jpeg");
    printf ("before save\n");
    gflSaveBitmap("o.jpg", GflBitmap, &save_option);
	return 0;
}

I have tested with several images and have always the same behaviour.
I hope you can help me with this problem.

Ithier
User avatar
xnview
Author of XnView
Posts: 43094
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Problem with gflBitmapSetIPTC and GFL 2.40

Post by xnview »

Ithier wrote:Hi,

I have tested the gflBitmapSetIPTC function and have a problem. When I save the image after I have added some iptc data and saved them in the GFL_BITMAP structure with the gflBitmapSetIPTC then the application crash when I call gflSaveBitmap. I have tested it with VC++ and dev-cpp (g++) and have the same problem. But it is very strange because when I use my debugger with dev-cpp, then it doesn't crash anymore !!

Here is the code to reproduce the problem:

Code: Select all

#include "libgfl.h"

int main(int argc, char *argv[])
{
	gflLibraryInit();

	GFL_LOAD_PARAMS load_option;
	gflGetDefaultLoadParams( &load_option );
    GFL_FILE_INFORMATION    GflFI;
    GFL_BITMAP*     GflBitmap;
	gflLoadBitmap(argv[1], &GflBitmap, &load_option, &GflFI);

    //Add iptc Data
    GFL_IPTC_DATA* iptc = gflNewIPTC();
    gflSetIPTCValue(iptc, GFL_IPTC_BYLINE, "moi");
    gflBitmapSetIPTC(GflBitmap, iptc);

   	GFL_SAVE_PARAMS save_option;
    gflGetDefaultSaveParams(&save_option);
    save_option.FormatIndex = gflGetFormatIndexByName("jpeg");
    printf ("before save\n");
    gflSaveBitmap("o.jpg", GflBitmap, &save_option);
	return 0;
}

I have tested with several images and have always the same behaviour.
I hope you can help me with this problem.

Ithier
Yes, strange. I have no problem. Perhaps you could send me a picture to check?
Pierre.