예제 #1
0
파일: jpgfile.c 프로젝트: Jerdak/meshlab
//--------------------------------------------------------------------------
// Read image data.
//--------------------------------------------------------------------------
int ReadJpegFile(const char * FileName, ReadMode_t ReadMode)
{
    FILE * infile;
    int ret;

    infile = fopen(FileName, "rb"); // Unix ignores 'b', windows needs it.

    if (infile == NULL) {
        fprintf(stderr, "can't open '%s'\n", FileName);
        return FALSE;
    }


    // Scan the JPEG headers.
    ret = ReadJpegSections(infile, ReadMode);
    if (!ret){
        if (ReadMode == READ_ANY){
            // Process any files mode.  Ignore the fact that it's not
            // a jpeg file.
            ret = TRUE;
        }else{
            fprintf(stderr,"Not JPEG: %s\n",FileName);
        }
    }

    fclose(infile);

    if (ret == FALSE){
        DiscardData();
    }
    return ret;
}
예제 #2
0
//--------------------------------------------------------------------------
// Read image data.
//--------------------------------------------------------------------------
int ReadJpegFile(const char * FileName, ReadMode_t ReadMode)
{
    FILE * infile;
    int ret;

    infile = fopen(FileName, "rb"); // Unix ignores 'b', windows needs it.

    if (infile == NULL) {
        ALOGE("can't open '%s'", FileName);
        fprintf(stderr, "can't open '%s'\n", FileName);
        return FALSE;
    }

    // Scan the JPEG headers.
    printf("ReadJpegSections");
    ret = ReadJpegSections(infile, ReadMode);
    if (!ret){
        ALOGV("Cannot parse JPEG sections for file: %s", FileName);
        fprintf(stderr,"Not JPEG: %s\n",FileName);
    }

    fclose(infile);

    if (ret == FALSE){
        DiscardData();
    }
    return ret;
}
예제 #3
0
//--------------------------------------------------------------------------
// process a EXIF jpeg file
//--------------------------------------------------------------------------
bool ExifData::scan(const QString & path)
{
    int ret;

    QFile f(path);
    if ( !f.open(IO_ReadOnly) )
        return false;

    try {
        // Scan the JPEG headers.
        ret = ReadJpegSections(f, READ_EXIF);
    }
    catch (FatalError& e) {
        e.debug_print();
        f.close();
        return false;
    }

    if (ret == false) {
        kdDebug(7034) << "Not JPEG file!\n";
        DiscardData();
        f.close();
        return false;
    }
    f.close();
    DiscardData();

    //now make the strings clean,
    // for exmaple my Casio is a "QV-4000   "
    CameraMake = CameraMake.stripWhiteSpace();
    CameraModel = CameraModel.stripWhiteSpace();
    UserComment = UserComment.stripWhiteSpace();
    Comment = Comment.stripWhiteSpace();
    return true;
}
예제 #4
0
파일: jpgfile.c 프로젝트: akkana/pho
//--------------------------------------------------------------------------
// Read image data.
//--------------------------------------------------------------------------
int ReadJpegFile(const char * FileName, ReadMode_t ReadMode)
{
    FILE * infile;
    int ret;

    infile = fopen(FileName, "rb"); // Unix ignores 'b', windows needs it.

    if (infile == NULL) {
        fprintf(stderr, "can't open '%s'\n", FileName);
        return FALSE;
    }

    // Scan the JPEG headers.
    ret = ReadJpegSections(infile, ReadMode);
#ifdef VERBOSE
    if (!ret){
        printf("Not JPEG: %s\n",FileName);
    }
#endif

    fclose(infile);

    if (ret == FALSE){
        DiscardData();
    }
    return ret;
}
예제 #5
0
파일: exif.cpp 프로젝트: JLuc/scribus
//--------------------------------------------------------------------------
// process a EXIF jpeg file
//--------------------------------------------------------------------------
bool ExifData::scan ( const QString & path )
{
	int ret;

	QFile f ( path );
	if ( !f.open ( QIODevice::ReadOnly ) )
		return false;
	ret = ReadJpegSections ( f, READ_EXIF );
	if ( ret == false )
	{
		f.close();
		return false;
	}
	f.close();

	//now make the strings clean,
	// for exmaple my Casio is a "QV-4000   "
	CameraMake = CameraMake.trimmed();
	CameraModel = CameraModel.trimmed();
	UserComment = UserComment.trimmed();
	Comment = Comment.trimmed();
	return true;
}