Beispiel #1
0
void Cexif::process_SOFn (const unsigned char * Data, int marker)
{
	m_exifinfo->Height = Get16m((void*)(Data+3));
	m_exifinfo->Width = Get16m((void*)(Data+5));
	unsigned char num_components = Data[7];

	if (num_components == 3) strcpy(m_exifinfo->IsColor,"yes");
	else strcpy(m_exifinfo->IsColor,"no");

	m_exifinfo->Process = marker;
}
Beispiel #2
0
//--------------------------------------------------------------------------
// Process a SOFn marker.  This is useful for the image dimensions
//--------------------------------------------------------------------------
void ExifData::process_SOFn ( const uchar * Data, int marker )
{
	int data_precision, num_components;

	data_precision = Data[2];
	ExifData::Height = Get16m ( Data+3 );
	ExifData::Width = Get16m ( Data+5 );
	num_components = Data[7];

	if ( num_components == 3 )
		ExifData::IsColor = 1;
	else
		ExifData::IsColor = 0;

	ExifData::Process = marker;

}
Beispiel #3
0
void Cexif::process_SOFn (const unsigned char * Data, int marker)
{
    int data_precision, num_components;

    data_precision = Data[2];
    m_exifinfo->Height = Get16m((void*)(Data+3));
    m_exifinfo->Width = Get16m((void*)(Data+5));
    num_components = Data[7];

    if (num_components == 3){
        m_exifinfo->IsColor = 1;
    }else{
        m_exifinfo->IsColor = 0;
    }

    m_exifinfo->Process = marker;

    //if (ShowTags) printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
    //               ImageInfo.Width, ImageInfo.Height, num_components, data_precision);
}
Beispiel #4
0
//--------------------------------------------------------------------------
// Process a SOFn marker.  This is useful for the image dimensions
//--------------------------------------------------------------------------
static void process_SOFn (const uchar * Data, int marker)
{
    int data_precision, num_components;

    data_precision = Data[2];
    ImageInfo.Height = Get16m(Data+3);
    ImageInfo.Width = Get16m(Data+5);
    num_components = Data[7];

    if (num_components == 3){
        ImageInfo.IsColor = 1;
    }else{
        ImageInfo.IsColor = 0;
    }

    ImageInfo.Process = marker;

    if (ShowTags){
        printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
                   ImageInfo.Width, ImageInfo.Height, num_components, data_precision);
    }
}
Beispiel #5
0
bool CExifRead::ProcessJFIF(unsigned char* pStart, unsigned int length)
{
	if ( memcmp(pStart, "JFIF", 5 ) == 0)
	{
		if ( length < 14)
		{
			return false;
		}
		if ( m_flags & EXIF_VERSION)
			strncpy_s(m_pExifInfo->Version,5,(char*)(pStart + 5), 2);

		if ( m_flags & EXIF_RESOLUTION_UNITS)
		{
			m_pExifInfo->ResolutionUnit = *(pStart + 7);
		}

		if ( m_flags & EXIF_XRESOLUTION)
		{
			m_pExifInfo->Xresolution = Get16m(pStart + 8);
		}

		if ( m_flags & EXIF_YRESOLUTION)
		{
			m_pExifInfo->Yresolution = Get16m(pStart + 10);
		}
	
		//ËõÂÔͼµÄ¿í¸ß
// 		m_pExifInfo->Width = *(pStart + 12);
// 		m_pExifInfo->Height = *(pStart + 13);

		return true;
	}
	else
	{
		return false;
	}
	
}
Beispiel #6
0
bool CExifRead::ProcessPhotoshop(unsigned char* pStart, unsigned int length, unsigned int offset)
{
	int temp = strlen(Photoshop_Header);
	if ( memcmp(pStart, Photoshop_Header, temp) == 0)
	{
		temp += 1;
		while ( temp < length)
		{
			if ( memcmp(pStart + temp, Photoshop_8BIM, 4) == 0)
			{
				temp += 4;
				int tag = Get16m(pStart + temp);
				int type = Get16m(pStart + temp + 2);
				int lengthTag = Get32m(pStart + temp + 4);
				if ( lengthTag%2 == 1)
				{
					lengthTag ++;
				}
				temp += 8;

				switch (tag)
				{
				case 0x040c:
					if ( m_bGetThumbNail && m_pExifInfo->pThumbnailPointer == NULL)
					{
						/*//0 Motorola-order Long Appears to always equal 1
						Officially, this denotes the 'format', and this value could also equal 0, but it is not clear what that should mean, nor have we ever seen this. 
						4 Motorola-order Long Thumbnail width 
						8 Motorola-order Long Thumbnail height 
						12 Motorola-order Long Scanline size ( = thumbnail width * 3, padded to nearest multiple of 4) 
						16 Motorola-order Long Total decompressed thumbnail memory size ( = scanline size * thumbnail height) 
						20 Motorola-order Long Size of the JFIF data ( = size of resource data - 28) 
						24 Motorola-order Word Appears to always equal 24
						Officially, this denotes the number of bits per pixel 
						26 Motorola-order Word Appears to always equal 1
						Officially, this denotes the number of planes 
						28 Variable number of bytes, as indicated by 'Size of JFIF data' field JFIF data 
						*/
						m_pExifInfo->ThumbnailSize = lengthTag - 28;

						unsigned char * dat = new unsigned char[m_pExifInfo->ThumbnailSize];
						memcpy(dat, pStart + temp + 28, m_pExifInfo->ThumbnailSize);
						m_pExifInfo->pThumbnailPointer = dat;

						m_pExifInfo->ThumbnailOffset = offset + temp + 28;
					}
					break;
				default :
					break;
				
				}
				temp += lengthTag;
			}
		}
		return true;
	}
	else
	{
		return false;
	}
	
}