Tiff format

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
nicolas66

Tiff format

Post by nicolas66 »

Hi there!

I have the following pice of code to load a sequence of images in a folder :

Code: Select all

	for( k=0; k<sz; k++ )
	{
		fscanf(fp, "%s", buffer);

		sprintf(image_info->filename, "%s/%s", path, buffer);
		printf("image read %s\n", image_info->filename);

		image = ReadImage(image_info,exception);

		if( image == (Image*)NULL )
			err_msg(3, "volume3D - unable to read image");

		if( k == 0 )
		{
			vol = new_volume3D(image->columns, image->rows, sz);

			vol->resolution[0] = resolution[0];
			vol->resolution[1] = resolution[1];
			vol->resolution[2] = resolution[2];

			if( (prefix = prefix_string(filename)) != NULL )
			{
				set_name_volume3D(&vol, prefix);
				free(prefix), prefix=(NULL);
			}
		}

		p = AcquireImagePixels(image, 0, 0, image->columns, image->rows, exception);

		/* pour lire le noir */
		indexes = GetIndexes(image);

		if( indexes != NULL )
		{
			for( i=0, index=(k*vol->sx*vol->sy); i<(vol->sx*vol->sy); i++, index++ )
				vol->values[index] = (float)indexes[i];
		}

		image = DestroyImage(image);

	}
This works well except for TIFF images which are all black. ImageMagick was compiled with libTIFF. The variable "indexes" containing grayscale values is NULL. So, is there a specific way to load TIFF images or not?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Tiff format

Post by magick »

Its possible the image is stored as a truecolor image which means the grayscale values are here: p.red;
Post Reply