IM_ImageT<T>::IM_ImageT(const char* filename, int save): MatrixImage<T>() {
    autoSave = save ;
    file_name = new char[1024] ; // 1024 characters for the name of a file, should be enough
    (void)strcpy(file_name,filename) ;
    GetImageInfo(&image_info) ;
    read(filename) ;
}
bool Image::write( const MC2String& filename ) {
   strcpy( m_image->filename, filename.c_str() );
   ::ImageInfo info;
   GetImageInfo( &info );

   return WriteImage( &info, m_image );
}
pair< unsigned char*, int >
Image::getBuffer() {
   size_t size = 0;
   ::ImageInfo info;
   GetImageInfo( &info );
   ExceptionInfo exception;
   GetExceptionInfo( &exception );

   unsigned char* blob = ImageToBlob( &info, m_image, &size,
                                      &exception );
   if ( blob == NULL ) {
      MC2String exceptionString = "Reason: ";
      exceptionString += exception.reason;
      exceptionString += "Description: ";
      exceptionString += exception.description;

      DestroyExceptionInfo( &exception );

      throw GSystem::Exception( "[ImageMagick]" + exceptionString );
   }

   DestroyExceptionInfo( &exception );

   return make_pair( blob, size );
}
示例#4
0
void* magickminify(void* src, ssize_t src_len, ssize_t* dst_len){
  Image *image, *resize;
  ImageInfo image_info;
  ExceptionInfo *exception;
  size_t len;
  void *ans;

  GetImageInfo(&image_info);
  exception = AcquireExceptionInfo();

  image = BlobToImage(&image_info, src, src_len, exception);

  if (exception->severity != UndefinedException)
    CatchException(exception);
  if (image == (Image *) NULL)
    exit(1);

  resize = MinifyImage(image, exception);

  if (exception->severity != UndefinedException)
    CatchException(exception);
  if (image == (Image *) NULL)
    exit(1);

  ans = ImageToBlob(&image_info, resize, &len, exception);
  
  if(dst_len != NULL)
    *dst_len = len;

  DestroyImage(image);
  DestroyImage(resize);
  DestroyExceptionInfo(exception);

  return ans;
}
示例#5
0
Magick::ReadOptions::ReadOptions(void)
  : _imageInfo(static_cast<ImageInfo*>(AcquireMagickMemory(
      sizeof(ImageInfo)))),
    _quiet(false)
{
  GetImageInfo(_imageInfo);
}
/*
Trasnfers the image or cancels the transfer depending on the state of the
TWAIN system
*/
void CTwain::TransferImage()
{
TW_IMAGEINFO info;
BOOL bContinue=TRUE;
	while(bContinue)
	{
		if(GetImageInfo(info))
		{
			int permission;
			permission = ShouldTransfer(info);
			switch(permission)
			{
			case TWCPP_CANCELTHIS:
					bContinue=EndTransfer();
					break;
			case TWCPP_CANCELALL:
					CancelTransfer();
					bContinue=FALSE;
					break;
			case TWCPP_DOTRANSFER:
					bContinue=GetImage(info);
					break;
			}
		}
	}
}
示例#7
0
/** Transfers the image or cancels the transfer depending on the state of the TWAIN system
 */
void TwainIface::TransferImage()
{
    TW_IMAGEINFO info;
    bool bContinue=true;

    while(bContinue)
    {
        if(GetImageInfo(info))
        {
            int permission = ShouldTransfer(info);

            switch(permission)
            {
                case TWCPP_CANCELTHIS:
                    bContinue=EndTransfer();
                    break;

                case TWCPP_CANCELALL:
                    CancelTransfer();
                    bContinue=false;
                    break;

                case TWCPP_DOTRANSFER:
                    bContinue=GetImage(info);
                    break;
            }
        }
    }
}
示例#8
0
/*
 * Class:     magick_ImageInfo
 * Method:    setFileName
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_magick_ImageInfo_setFileName
    (JNIEnv *env, jobject obj, jstring fileName)
{
    ImageInfo *imageInfo = NULL;
    jfieldID handleFid = 0;
    const char *cstr = NULL;

    imageInfo = (ImageInfo*) getHandle(env, obj,
				       "imageInfoHandle", &handleFid);

    if (imageInfo == NULL) {
	imageInfo = (ImageInfo *) AcquireMemory(sizeof(ImageInfo));
	if (imageInfo == NULL) {
	    throwMagickException(env, "Unable to allow memory for handle");
	    return;
	}
	GetImageInfo(imageInfo);
	setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &handleFid);
    }

    cstr = (*env)->GetStringUTFChars(env, fileName, 0);
    strcpy(imageInfo->filename, cstr);
    (*env)->ReleaseStringUTFChars(env, fileName, cstr);

#ifdef DIAGNOSTIC
    fprintf(stderr, "Set the file name in ImageInfo to %s\n",
            imageInfo->filename);
#endif
}
示例#9
0
文件: cin.cpp 项目: 2asoft/xray
BMMRES
BitmapIO_CIN::GetImageInfoDlg(HWND hWnd, BitmapInfo* bmi, const TCHAR* fname)
{
    BitmapInfo  bInfo;
    if (!bmi) {
        assert(FALSE);
        return ProcessImageIOError(bmi, GetResIDCaption(IDS_CIN_Internal_Error));
    }

	bInfo.Copy(bmi);

    if (fname)
		bInfo.SetName(fname);

    BMMRES bmmResult = GetImageInfo(&bInfo);
    if (bmmResult != BMMRES_SUCCESS) {
        return bmmResult;
    }

#ifdef BASIC_INFO_DLG
    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CIN_BASIC_INFO),
                   hWnd, (DLGPROC) CIN_ImageInfoDialogProc, (LPARAM) this);
#else
    DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CIN_INFO),
                   hWnd, (DLGPROC) CIN_ImageInfoDialogProc, (LPARAM) this);
#endif

    return BMMRES_SUCCESS;
}
示例#10
0
/*
Trasnfers the image or cancels the transfer depending on the state of the
TWAIN system
*/
void CTwain::TransferImage()
{
	TW_IMAGEINFO info;
	BOOL bContinue = TRUE;
	int nScanStatus = 0;		//扫描结束时状态,1--正常扫描结束
	TRACE("********** TransferImage ************\n");
	while(bContinue)
	{
		if (GetImageInfo(info) && _bTwainContinue)		//GetImageInfo(info)
		{
			int permission;
			permission = ShouldTransfer(info);
			switch(permission)
			{
			case TWCPP_CANCELTHIS:
				TRACE("************ TransferImage--> TWCPP_CANCELTHIS. 1 ************\n");
					bContinue=EndTransfer();
					nScanStatus = -1;
					TRACE("************ TransferImage--> TWCPP_CANCELTHIS.2 ************\n");
					break;
			case TWCPP_CANCELALL:
				TRACE("************ TransferImage--> TWCPP_CANCELALL. 1 ************\n");
					CancelTransfer();
					bContinue=FALSE;
					nScanStatus = -2;
					TRACE("************ TransferImage--> TWCPP_CANCELALL. 2 ************\n");
					break;
			case TWCPP_DOTRANSFER:
				TRACE("********** TransferImage --> TWCPP_DOTRANSFER ************\n");
					bContinue=GetImage(info);
					if (!_bHasNextPic)
						nScanStatus = 1;
					else
						nScanStatus = 2; 
					break;
			default:
				TRACE("************ TransferImage--> default. ************\n");
				bContinue = FALSE;
				nScanStatus = -3;
				break;
			}
		}
		else
		{
			TRACE("************ TransferImage --> GetImageInfo failed or m_bContinue = false *************\n");
			nScanStatus = -4;
			EndTransfer();
			bContinue = FALSE;
		}
	}
	TRACE("******* 扫描完成 ***********\n");
	ScanDone(nScanStatus);
}
示例#11
0
static WebPMuxError GetImageCanvasWidthHeight(
    const WebPMux* const mux, uint32_t flags,
    int* const width, int* const height) {
  WebPMuxImage* wpi = NULL;
  assert(mux != NULL);
  assert(width != NULL && height != NULL);

  wpi = mux->images_;
  assert(wpi != NULL);
  assert(wpi->img_ != NULL);

  if (wpi->next_) {
    int max_x = 0;
    int max_y = 0;
    int64_t image_area = 0;
    // Aggregate the bounding box for animation frames & tiled images.
    for (; wpi != NULL; wpi = wpi->next_) {
      int x_offset, y_offset, duration, w, h;
      const WebPMuxError err = GetImageInfo(wpi, &x_offset, &y_offset,
                                            &duration, &w, &h);
      const int max_x_pos = x_offset + w;
      const int max_y_pos = y_offset + h;
      if (err != WEBP_MUX_OK) return err;
      assert(x_offset < MAX_POSITION_OFFSET);
      assert(y_offset < MAX_POSITION_OFFSET);

      if (max_x_pos > max_x) max_x = max_x_pos;
      if (max_y_pos > max_y) max_y = max_y_pos;
      image_area += w * h;
    }
    *width = max_x;
    *height = max_y;
    // Crude check to validate that there are no image overlaps/holes for tile
    // images. Check that the aggregated image area for individual tiles exactly
    // matches the image area of the constructed canvas. However, the area-match
    // is necessary but not sufficient condition.
    if ((flags & TILE_FLAG) && (image_area != (max_x * max_y))) {
      *width = 0;
      *height = 0;
      return WEBP_MUX_INVALID_ARGUMENT;
    }
  } else {
    // For a single image, extract the width & height from VP8/VP8L image-data.
    int w, h;
    const WebPChunk* const image_chunk = wpi->img_;
    const WebPMuxError err = MuxGetImageWidthHeight(image_chunk, &w, &h);
    if (err != WEBP_MUX_OK) return err;
    *width = w;
    *height = h;
  }
  return WEBP_MUX_OK;
}
示例#12
0
void ImageWidget::readImageInfo()
{
     int nn = socket->bytesAvailable();
     if(bytesReceived <= 0)
     {
         if(socket->bytesAvailable() > 0)
         {
            info = new ImageInfo();
            bytesReceived = socket->bytesAvailable();
            QByteArray tt = socket->readAll();

            QByteArray bt = tt.left(8);
            QDataStream stream1(bt);
            qint64 infosize;
            stream1 >>infosize;
            tt.remove(0,8);

            QByteArray ct = tt.left(8);
            QDataStream stream2(ct);
            stream2 >>totalBytes;
            tt.remove(0,8);

            QByteArray infoData = tt.left((int)infosize);
            tt.remove(0,(int)infosize);

            QString readData = QString::fromUtf8(infoData);
            QStringList ColumnList  = readData.split(":");
            info->id = ColumnList.at(0);
            info->title = ColumnList.at(1);
            info->size = ColumnList.at(2);
            info->path = ColumnList.at(3);
            info->bm = tt;

            if(bytesReceived == totalBytes)
            {
               socket->disconnectFromHost();
               imageInfoList.append(*info);
               insertTableRow(*info);
               currentNum++;
               if(currentNum < imageCount)
               {
                   ui->progressBar->setValue(currentNum);
                   GetImageInfo(currentNum);
               }else{
                   disconnect(socket,SIGNAL(readyRead()),this,SLOT(readImageInfo()));
                   connect(playlist,SIGNAL(clicked(QModelIndex)),this,SLOT(ImageChange(QModelIndex)));
                   connect(playlist, SIGNAL(cellChanged(int,int)), this, SLOT(CheckBoxChanged(int, int)));
                   ui->progressBar->hide();
               }
            }
         }
示例#13
0
// Constructor
Magick::Options::Options( void )
  : _imageInfo(static_cast<ImageInfo*>(AcquireMagickMemory(sizeof(ImageInfo)))),
    _quantizeInfo(static_cast<QuantizeInfo*>(AcquireMagickMemory(sizeof(QuantizeInfo)))),
    _drawInfo(static_cast<DrawInfo*>(AcquireMagickMemory( sizeof(DrawInfo))))
{
  // Initialize image info with defaults
  GetImageInfo( _imageInfo );
  
  // Initialize quantization info
  GetQuantizeInfo( _quantizeInfo );

  // Initialize drawing info
  GetDrawInfo( _imageInfo, _drawInfo );
}
示例#14
0
static WebPMuxError GetImageCanvasWidthHeight(
    const WebPMux* const mux, uint32_t flags,
    int* const width, int* const height) {
  WebPMuxImage* wpi = NULL;
  assert(mux != NULL);
  assert(width != NULL && height != NULL);

  wpi = mux->images_;
  assert(wpi != NULL);
  assert(wpi->img_ != NULL);

  if (wpi->next_ != NULL) {
    int max_x = 0;
    int max_y = 0;
    int64_t image_area = 0;
    // if we have a chain of wpi's, header_ is necessarily set
    assert(wpi->header_ != NULL);
    // Aggregate the bounding box for animation frames & fragmented images.
    for (; wpi != NULL; wpi = wpi->next_) {
      int x_offset = 0, y_offset = 0, duration = 0, w = 0, h = 0;
      const WebPMuxError err = GetImageInfo(wpi, &x_offset, &y_offset,
                                            &duration, &w, &h);
      const int max_x_pos = x_offset + w;
      const int max_y_pos = y_offset + h;
      if (err != WEBP_MUX_OK) return err;
      assert(x_offset < MAX_POSITION_OFFSET);
      assert(y_offset < MAX_POSITION_OFFSET);

      if (max_x_pos > max_x) max_x = max_x_pos;
      if (max_y_pos > max_y) max_y = max_y_pos;
      image_area += w * h;
    }
    *width = max_x;
    *height = max_y;
    // Crude check to validate that there are no image overlaps/holes for
    // fragmented images. Check that the aggregated image area for individual
    // fragments exactly matches the image area of the constructed canvas.
    // However, the area-match is necessary but not sufficient condition.
    if ((flags & FRAGMENTS_FLAG) && (image_area != (max_x * max_y))) {
      *width = 0;
      *height = 0;
      return WEBP_MUX_INVALID_ARGUMENT;
    }
  } else {
    // For a single image, canvas dimensions are same as image dimensions.
    *width = wpi->width_;
    *height = wpi->height_;
  }
  return WEBP_MUX_OK;
}
示例#15
0
/*
 * Class:     magick_ImageInfo
 * Method:    init
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_magick_ImageInfo_init
    (JNIEnv *env, jobject obj)
{
    ImageInfo *imageInfo = NULL;
    jfieldID fid = 0;

    imageInfo = (ImageInfo*) getHandle(env, obj, "imageInfoHandle", &fid);

    if (imageInfo == NULL) {
	imageInfo = (ImageInfo *) AcquireMemory(sizeof(ImageInfo));
	if (imageInfo == NULL) {
	    throwMagickException(env, "Unable to allocate memory for handle");
	    return;
	}
    }
    GetImageInfo(imageInfo);

    setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &fid);
}
示例#16
0
ImageWidget::ImageWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ImageWidget)
{
    ui->setupUi(this);
    QSettings settings;
    ip = settings.value("wlanIP").toString();
    port = settings.value("sPort").toInt();

    playlist = ui->tableWidget;
    //设置只能选择单行
    playlist->setSelectionMode(QAbstractItemView::SingleSelection);
    playlist->setSelectionBehavior(QAbstractItemView::SelectRows);
    //设置不显示网格
    playlist->setShowGrid(false);
    //禁止修改内容
    playlist->setEditTriggers(QAbstractItemView::NoEditTriggers);

    connect(ui->pushButton_in, SIGNAL(clicked()), this, SLOT(PushFile()));
    connect(ui->pushButton_out, SIGNAL(clicked()), this, SLOT(PullFile()));

    android = new AndroidAPK();

    imageLabel  = ui->label;
    imageLabel->setAlignment(Qt::AlignCenter);
    image = new QImage();

    socket = new QTcpSocket();

    loadSize = 10*1024;

    currentNum = -1;
    imageCount = 0;
    imageCount = getImagetCount();
    if(imageCount > 0)
    {
        ui->msg_label->setText(tr("All: %1").arg(QString::number(imageCount)));
        currentNum = 0;
        ui->progressBar->setMaximum(imageCount-1);
        ui->progressBar->setValue(currentNum);
        GetImageInfo(currentNum);
    }
}
/*
  We use BlobToImage to load input as an image, if successful destroy image.  
*/
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
  Image *image;
  ImageInfo image_info;
  ExceptionInfo *exception;

  GetImageInfo(&image_info);
  exception = AcquireExceptionInfo();

  image = BlobToImage(&image_info, data, size, exception);
  if (exception->severity != UndefinedException){
    //CatchException(exception);      
  }
  if(image != (Image *) NULL){
    DestroyImage(image);
  }
  
  DestroyExceptionInfo(exception);

  return 0;
}
示例#18
0
void Spaceship::FireBullet()
{
   LOG_DEBUG() << "FireBullet";
   theTicksSinceLastBullet++;

   if (theTicksSinceLastBullet < theFireDelayMap[theFireMode])
   {
      // Gun is in the cooldown period still
      return;
   }
   else
   {
      // Reseting cooldown period
      theTicksSinceLastBullet = 0;
   }

   if (theLifetimeMgr == nullptr)
   {
      LOG_WARNING() << "Can't fire because we never got spaceship doesn't have lifetime mgr";
      return;
   }

   FrictionlessGraphic* b = new FrictionlessGraphic("assets/shot2.png", theMapBounds, GetImageInfo()->GetRenderer());
   b->SetUpdateRate(theUpdateRateHz);
   b->SetLifetime(5.0, theLifetimeMgr, ShootingSceneLifetimeCodes::REMOVE_CODE_BULLET);
   b->SetAngle(theAngle);

   XYPair directionUnitVec = GameMath::GetUnitVector(theAngle);
   XYPair bulletVel = directionUnitVec;
   bulletVel *= 100.0;
   bulletVel += theVelocity;
   b->SetVelocity(bulletVel);

   static float bulletOffset = GetImageInfo()->GetSize()[0] / 2.0;
   XYPair bulletPos = thePosition + directionUnitVec * bulletOffset;
   b->SetPosition(bulletPos);

   theLifetimeMgr->AddEntity(b, ShootingSceneLifetimeCodes::ADD_CODE_BULLET);
}
示例#19
0
// Returns the tightest dimension for the canvas considering the image list.
static WebPMuxError GetAdjustedCanvasSize(const WebPMux* const mux,
                                          int* const width, int* const height) {
  WebPMuxImage* wpi = NULL;
  assert(mux != NULL);
  assert(width != NULL && height != NULL);

  wpi = mux->images_;
  assert(wpi != NULL);
  assert(wpi->img_ != NULL);

  if (wpi->next_ != NULL) {
    int max_x = 0, max_y = 0;
    // if we have a chain of wpi's, header_ is necessarily set
    assert(wpi->header_ != NULL);
    // Aggregate the bounding box for animation frames.
    for (; wpi != NULL; wpi = wpi->next_) {
      int x_offset = 0, y_offset = 0, duration = 0, w = 0, h = 0;
      const WebPMuxError err = GetImageInfo(wpi, &x_offset, &y_offset,
                                            &duration, &w, &h);
      const int max_x_pos = x_offset + w;
      const int max_y_pos = y_offset + h;
      if (err != WEBP_MUX_OK) return err;
      assert(x_offset < MAX_POSITION_OFFSET);
      assert(y_offset < MAX_POSITION_OFFSET);

      if (max_x_pos > max_x) max_x = max_x_pos;
      if (max_y_pos > max_y) max_y = max_y_pos;
    }
    *width = max_x;
    *height = max_y;
  } else {
    // For a single image, canvas dimensions are same as image dimensions.
    *width = wpi->width_;
    *height = wpi->height_;
  }
  return WEBP_MUX_OK;
}
示例#20
0
// -------------------------------------------------------------------------------- //
int guAmazonCoverFetcher::ExtractImagesInfo( wxString &content )
{
    int RetVal = 0;
    wxStringInputStream ins( content );
    wxXmlDocument XmlDoc( ins );
    wxXmlNode * XmlSubNode;
    wxXmlNode * XmlNode = XmlDoc.GetRoot();
    if( XmlNode && XmlNode->GetName() == wxT( "ItemSearchResponse" ) )
    {
        XmlNode = XmlNode->GetChildren();
        while( XmlNode )
        {
            if( XmlNode->GetName() == wxT( "Items" ) )
            {
                XmlNode = XmlNode->GetChildren();
                while( XmlNode )
                {
                    if( XmlNode->GetName() == wxT( "Request" ) )
                    {
                        XmlSubNode = XmlNode->GetChildren();
                        while( XmlSubNode )
                        {
                            if( XmlSubNode->GetName() == wxT( "IsValid" ) )
                            {
                                if( XmlSubNode->GetNodeContent() != wxT( "True" ) )
                                {
                                    guLogError( wxT( "There was an error in the amazon search request." ) );
                                }
                                break;
                            }
                            XmlSubNode = XmlSubNode->GetNext();
                        }
                    }
                    else if( XmlNode->GetName() == wxT( "Errors" ) )
                    {
                        XmlSubNode = XmlNode->GetChildren();
                        while( XmlSubNode )
                        {
                            if( XmlSubNode->GetName() == wxT( "Error" ) )
                            {
                                XmlSubNode = XmlSubNode->GetChildren();
                                while( XmlSubNode )
                                {
                                    if( XmlSubNode->GetName() == wxT( "Message" ) )
                                    {
                                        guLogError( wxT( "Error: %s" ), XmlSubNode->GetNodeContent().c_str() );
                                        break;
                                    }
                                    XmlSubNode = XmlSubNode->GetNext();
                                }
                                return 0;
                            }
                            XmlSubNode = XmlSubNode->GetNext();
                        }
                    }
                    else if( XmlNode->GetName() == wxT( "Item" ) )
                    {
                        wxArrayString CurItem = GetImageInfo( XmlNode );
                        if( CurItem.Count() )
                        {
                            m_CoverLinks->Add( CurItem );
                            RetVal++;
                        }
                    }
                    XmlNode = XmlNode->GetNext();
                }
                break;
            }
            XmlNode = XmlNode->GetNext();
        }
    }
    return RetVal;
}
示例#21
0
BitmapStorage *BitmapIO_YUV::Load(BitmapInfo *fbi, Bitmap *map, BMMRES *status) {

     unsigned char *yuvbuf = NULL;
     BMM_Color_64  *rgbbuf = NULL;
     BitmapStorage *s      = NULL;

	//-- Initialize Status Optimistically

	*status = BMMRES_SUCCESS;

	//-- Make sure nothing weird is going on

	if(openMode != BMM_NOT_OPEN) {
		*status = ProcessImageIOError(fbi,BMMRES_INTERNALERROR);
		return NULL;
	}

     //-- Update Bitmap Info
     
     *status = GetImageInfo(fbi);
     
     if (*status != BMMRES_SUCCESS)
        return(NULL);

     //-- Open YUV File -----------------------------------
     
     File file(fbi->Name(), _T("rb"));

	 inStream = file.stream;
     if (inStream == NULL) {
		*status = ProcessImageIOError(fbi);
        return NULL;
     }

     //-- Create Image Storage ---------------------------- 
     
     s = BMMCreateStorage(map->Manager(),BMM_TRUE_32);

     if(!s) {
		*status = ProcessImageIOError(fbi,BMMRES_INTERNALERROR);
        return NULL;
     }

     //-- Allocate Image Storage --------------------------
     
     if (s->Allocate(fbi,map->Manager(),BMM_OPEN_R)==0) {
        memory_error_out:
		*status = ProcessImageIOError(fbi,BMMRES_MEMORYERROR);
        goto bail_out;
        io_error_out:
		*status = ProcessImageIOError(fbi);
        bail_out:
        if (s) 
           delete s;
        if (yuvbuf)
           free(yuvbuf);
        if (rgbbuf)
           free(rgbbuf);
        return NULL;
     }

     //-- Allocate Buffers --------------------------------
     
     yuvbuf=(unsigned char *)malloc(fbi->Width()*2);
     rgbbuf=(BMM_Color_64  *)malloc(fbi->Width()*sizeof(BMM_Color_64));

     if(!yuvbuf || !rgbbuf)
        goto memory_error_out;
     
     //-- Read Image

     INT_PTR pixels = fbi->Width() * fbi->Height();
     int rows   = 0;
     
     while (pixels) {
        pixels = fread(yuvbuf,2,fbi->Width(),inStream);
        if (pixels != fbi->Width() && pixels != 0)  {
           goto io_error_out;
        }
        if (pixels)  {
           YUVtoRGB(rgbbuf,yuvbuf,fbi->Width());
           if (s->PutPixels(0,rows,fbi->Width(),rgbbuf)!=1)
              goto io_error_out;
           rows++;
           if (rows>fbi->Height()) break;
        }   

        //-- Progress Report
        
        if (fbi->GetUpdateWindow())
           SendMessage(fbi->GetUpdateWindow(),BMM_PROGRESS,rows,fbi->Height());

     }
     
     if (yuvbuf)
        free(yuvbuf);
     if (rgbbuf)
        free(rgbbuf);

     //-- Set the storage's BitmapInfo

     s->bi.CopyImageInfo(fbi);
     return  s;

}
示例#22
0
IM_ImageT<T>::IM_ImageT(): MatrixImage<T>() {
    autoSave = 0 ;
    file_name = 0 ;
    image = 0 ;
    GetImageInfo(&image_info) ;
}
示例#23
0
IM_ImageT<T>::IM_ImageT(const int r, const int c): MatrixImage<T>(r,c) {
    autoSave = 0 ;
    file_name = 0 ;
    image = 0 ;
    GetImageInfo(&image_info) ;
}
示例#24
0
文件: files.c 项目: Schala/mhxd
void
rcv_file_get (struct htlc_conn *htlc)
{
	u_int16_t fnlen = 0, preview = 0;
	char path[MAXPATHLEN], dir[MAXPATHLEN], filename[NAME_MAX];
	char abuf[HOSTLEN+1], buf[128];
	struct stat sb;
	u_int32_t size = 0, data_size = 0, rsrc_size = 0, ref, 
		  data_pos = 0, rsrc_pos = 0;
	int err, siz, len;
	struct SOCKADDR_IN lsaddr;
	struct htxf_conn *htxf;
	u_int16_t i;
#if defined(CONFIG_HTXF_QUEUE)
	u_int16_t queue_pos;
#endif

	dir[0] = 0;

	if (htlc->nr_gets >= htlc->get_limit) {
		for (i = 0; i < HTXF_GET_MAX; i++) {
			htxf = htlc->htxf_out[i];
			if (!htxf)
				continue;
			if ((htxf->total_pos == htxf->total_size)
			    || htxf->gone)
				goto ok;
		}
		len = snprintf(buf, sizeof(buf), "%u at a time", htlc->get_limit);
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, len, buf);
		return;
	}
ok:
#if defined(CONFIG_HTXF_QUEUE)
	if (!htlc->access_extra.ignore_queue && nr_queued >= hxd_cfg.limits.queue_size) {
#else
	if (nr_gets >= hxd_cfg.limits.total_downloads) {
#endif
#if defined(CONFIG_HTXF_QUEUE)
		len = snprintf(buf, sizeof(buf),
			       "queue is full (%u >= %d) please try again later",
			       nr_gets, hxd_cfg.limits.queue_size);
#else
		len = snprintf(buf, sizeof(buf),
			       "maximum number of total downloads reached (%u >= %d)",
			       nr_gets, hxd_cfg.limits.total_downloads);
#endif
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, len, buf);
		return;
	}
	for (i = 0; i < HTXF_GET_MAX; i++)
		if (!htlc->htxf_out[i])
			break;
	if (i == HTXF_GET_MAX) {
		snd_strerror(htlc, EAGAIN);
		return;
	}

	dh_start(htlc)
		switch (dh_type) {
			case HTLC_DATA_FILE_NAME:
				fnlen = dh_len >= NAME_MAX ? NAME_MAX - 1 : dh_len;
				read_filename(filename, dh_data, fnlen);
				break;
			case HTLC_DATA_DIR:
				if ((err = hldir_to_path(dh, ROOTDIR, dir, dir))) {
					snd_strerror(htlc, err);
					return;
				}
				break;
			case HTLC_DATA_RFLT:
				if (dh_len >= 50)
					L32NTOH(data_pos, &dh_data[46]);
				if (dh_len >= 66)
					L32NTOH(rsrc_pos, &dh_data[62]);
				break;
			case HTLC_DATA_FILE_PREVIEW:
				dh_getint(preview);
				break;
		}
	dh_end()

	if (!fnlen && !dir[0]) {
		/* No file name given */
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, 6, "huh?!?");
		return;
	}

	if (dir[0]) {
		if (fnlen)
			snprintf(path, sizeof(path), "%s/%s", dir, filename);
		else
			strcpy(path, dir);
	} else {
		snprintf(path, sizeof(path), "%s/%s", ROOTDIR, filename);
	}
#ifdef HAVE_CORESERVICES
	resolve_alias_path(path, path);
#endif
	if (check_dropbox(htlc, path)) {
		snd_strerror(htlc, EPERM);
		return;
	}

#ifdef CONFIG_HTXF_PREVIEW
	if (preview) {
		Image *img, *mimg;
		ImageInfo ii;
		ExceptionInfo ei;
		char previewpath[MAXPATHLEN];
		static int magick_inited = 0;

		if (!magick_inited) {
			InitializeMagick("hxd");
			magick_inited = 1;
		}

#if MaxTextExtent < MAXPATHLEN
		if (strlen(path) >= sizeof(ii.filename)) {
			hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR,
				13, "path too long");
			return;
		}
#endif
		memset(&ii, 0, sizeof(ii));
		memset(&ei, 0, sizeof(ei));
		GetImageInfo(&ii);
		GetExceptionInfo(&ei);

		err = preview_path(previewpath, path, &sb);
		if (!err) {
			/* Preview file already exists */
			strcpy(ii.filename, previewpath);
			mimg = ReadImage(&ii, &ei);
		} else {
			/* Create preview file */
			strcpy(ii.filename, path);
			img = ReadImage(&ii, &ei);
			if (!img)
				goto text_preview;
			mimg = MinifyImage(img, &ei);
			DestroyImage(img);
		}
		if (!mimg) {
			hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR,
				18, "MinifyImage failed");
			return;
		}
		if (err) {
			err = preview_path(previewpath, path, 0);
			if (err) {
				snd_strerror(htlc, err);
				DestroyImage(mimg);
				return;
			}
			strcpy(mimg->filename, previewpath);
			data_pos = 0;
			rsrc_pos = 0;
			WriteImage(&ii, mimg);
			DestroyImage(mimg);
		} else {
			DestroyImage(mimg);
		}
		strcpy(path, previewpath);
	}

text_preview:
#endif
	if (stat(path, &sb)) {
		snd_strerror(htlc, errno);
		return;
	}

	if (S_ISDIR(sb.st_mode)) {
		snd_strerror(htlc, EISDIR);
		return;
	}

	data_size = sb.st_size;
	size = (data_size - data_pos) + (preview ? 0 : 133);
#if defined(CONFIG_HFS)
	if (hxd_cfg.operation.hfs) {
		rsrc_size = resource_len(path);
		size += preview ? 0 : (rsrc_size - rsrc_pos);
		if (!preview)
			size += ((rsrc_size - rsrc_pos) ? 16 : 0) + comment_len(path);
	}
#endif

	ref = htxf_ref_new(htlc);
	ref = htonl(ref);

	siz = sizeof(struct SOCKADDR_IN);
	if (getsockname(htlc->fd, (struct sockaddr *)&lsaddr, &siz)) {
		hxd_log("rcv_file_get: getsockname: %s", strerror(errno));
		snd_strerror(htlc, errno);
		return;
	}
	htxf = htxf_new(htlc, 0);
	htxf->type = HTXF_TYPE_FILE;
	htxf->data_size = data_size;
	htxf->rsrc_size = rsrc_size;
	htxf->data_pos = data_pos;
	htxf->rsrc_pos = rsrc_pos;
	htxf->total_size = size;
	htxf->ref = ref;
	htxf->limit_out_Bps = htlc->nr_puts > 0 ?
		(htlc->limit_uploader_out_Bps ? htlc->limit_uploader_out_Bps : htlc->limit_out_Bps) :
		  htlc->limit_out_Bps;
	hxd_log("conf: %u!%u", htxf->limit_out_Bps, htlc->limit_out_Bps);
	htxf->preview = preview;
	htxf->sockaddr = htlc->sockaddr;
	htxf->listen_sockaddr = lsaddr;
	htxf->listen_sockaddr.SIN_PORT = htons(ntohs(htxf->listen_sockaddr.SIN_PORT) + 1);
	strcpy(htxf->path, path);

	htlc->nr_gets++;
	nr_gets++;
#if defined(CONFIG_HTXF_QUEUE)
	if (htlc->access_extra.ignore_queue)
		htxf->queue_pos = queue_pos = 0;
	else
		htxf->queue_pos = queue_pos = insert_into_queue(htlc);
#endif

	if (log_download) {
		inaddr2str(abuf, &htlc->sockaddr);
		hxd_log("%s@%s:%u - %s:%u:%u:%s - download %s:%08x", htlc->userid, abuf, ntohs(htlc->sockaddr.SIN_PORT),
			htlc->name, htlc->icon, htlc->uid, htlc->login, htxf->path, htxf->ref);
#if defined(CONFIG_SQL)
		sql_download(htlc->name, abuf, htlc->login, path);
#endif
	}
	size = htonl(size);
#if defined(CONFIG_HTXF_QUEUE)
	queue_pos = htons(queue_pos);
	hlwrite(htlc, HTLS_HDR_TASK, 0, 3,
		HTLS_DATA_HTXF_REF, sizeof(ref), &ref,
		HTLS_DATA_HTXF_SIZE, sizeof(size), &size,
		HTLS_DATA_QUEUE_POSITION, sizeof(queue_pos), &queue_pos);
#else
	hlwrite(htlc, HTLS_HDR_TASK, 0, 2,
		HTLS_DATA_HTXF_REF, sizeof(ref), &ref,
		HTLS_DATA_HTXF_SIZE, sizeof(size), &size);
#endif
}

void
rcv_file_put (struct htlc_conn *htlc)
{
	u_int16_t fnlen = 0, resume = 0;
	char path[MAXPATHLEN], dir[MAXPATHLEN], filename[NAME_MAX];
	char abuf[HOSTLEN+1], buf[128];
	struct stat sb;
	int err, siz, len;
	u_int32_t ref, data_pos = 0, rsrc_pos = 0, totalsize = 0;
	u_int8_t rflt[74];
	struct SOCKADDR_IN lsaddr;
	struct htxf_conn *htxf;
	u_int16_t i;

	dir[0] = 0;

	if (htlc->nr_puts >= htlc->put_limit) {
		len = snprintf(buf, sizeof(buf), "%u at a time", htlc->put_limit);
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, len, buf);
		return;
	}
	if (nr_puts >= hxd_cfg.limits.total_uploads) {
		len = snprintf(buf, sizeof(buf), "maximum number of total uploads reached (%u >= %d)",
			       nr_gets, hxd_cfg.limits.total_uploads);
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, len, buf);
		return;
	}
	for (i = 0; i < HTXF_PUT_MAX; i++)
		if (!htlc->htxf_in[i])
			break;
	if (i == HTXF_PUT_MAX) {
		snd_strerror(htlc, EAGAIN);
		return;
	}

	dh_start(htlc)
		switch (dh_type) {
			case HTLC_DATA_FILE_NAME:
				fnlen = dh_len >= NAME_MAX ? NAME_MAX - 1 : dh_len;
				read_filename(filename, dh_data, fnlen);
				break;
			case HTLC_DATA_DIR:
				if ((err = hldir_to_path(dh, ROOTDIR, dir, dir))) {
					snd_strerror(htlc, err);
					return;
				}
				break;
			case HTLC_DATA_FILE_PREVIEW:
				dh_getint(resume);
				break;
			case HTLC_DATA_HTXF_SIZE:
				dh_getint(totalsize);
				break;
		}
	dh_end()

	if (!htlc->access.upload_anywhere && (!dir[0] || (!strcasestr(dir, "UPLOAD") && !strcasestr(dir, "DROP BOX")))) {
		snd_strerror(htlc, EPERM);
		return;
	}
	if (!fnlen && !dir[0]) {
		/* No file name given */
		hlwrite(htlc, HTLS_HDR_TASK, 1, 1, HTLS_DATA_TASKERROR, 6, "huh?!?");
		return;
	}

	if (dir[0]) {
		if (fnlen)
			snprintf(path, sizeof(path), "%s/%s", dir, filename);
		else
			strcpy(path, dir);
	} else {
		snprintf(path, sizeof(path), "%s/%s", ROOTDIR, filename);
	}
#ifdef HAVE_CORESERVICES
	resolve_alias_path(path, path);
#endif
	if (!resume) {
		if (!stat(path, &sb)) {
			snd_strerror(htlc, EEXIST);
			return;
		}
		if (errno != ENOENT) {
			snd_strerror(htlc, errno);
			return;
		}
	} else {
		if (stat(path, &sb)) {
			snd_strerror(htlc, errno);
			return;
		}
		data_pos = sb.st_size;
#if defined(CONFIG_HFS)
		if (hxd_cfg.operation.hfs)
			rsrc_pos = resource_len(path);
#endif
		memcpy(rflt, "RFLT\0\1\
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
\0\0\0\2DATA\0\0\0\0\0\0\0\0\0\0\0\0MACR\0\0\0\0\0\0\0\0\0\0\0\0", 74);
		S32HTON(data_pos, &rflt[46]);
		S32HTON(rsrc_pos, &rflt[62]);
	}

	ref = htxf_ref_new(htlc);
	ref = htonl(ref);

	siz = sizeof(struct SOCKADDR_IN);
	if (getsockname(htlc->fd, (struct sockaddr *)&lsaddr, &siz)) {
		hxd_log("rcv_file_get: getsockname: %s", strerror(errno));
		snd_strerror(htlc, errno);
		return;
	}
	htxf = htxf_new(htlc, 1);
	htxf->type = HTXF_TYPE_FILE;
	htxf->data_pos = data_pos;
	htxf->rsrc_pos = rsrc_pos;
	htxf->total_size = totalsize;
	htxf->ref = ref;
	htxf->sockaddr = htlc->sockaddr;
	htxf->listen_sockaddr = lsaddr;
	htxf->listen_sockaddr.SIN_PORT = htons(ntohs(htxf->listen_sockaddr.SIN_PORT) + 1);
	strcpy(htxf->path, path);

	htlc->nr_puts++;
	nr_puts++;
	if (log_upload) {
		inaddr2str(abuf, &htlc->sockaddr);
		hxd_log("%s@%s:%u - %s:%u:%u:%s - upload %s:%08x", htlc->userid, abuf, ntohs(htlc->sockaddr.SIN_PORT),
			htlc->name, htlc->icon, htlc->uid, htlc->login, htxf->path, htxf->ref);
#if defined(CONFIG_SQL)
		sql_upload(htlc->name, abuf, htlc->login, path);
#endif
	}
	if (!resume)
		hlwrite(htlc, HTLS_HDR_TASK, 0, 1,
			HTLS_DATA_HTXF_REF, sizeof(ref), &ref);
	else
		hlwrite(htlc, HTLS_HDR_TASK, 0, 2,
			HTLS_DATA_RFLT, 74, rflt,
			HTLS_DATA_HTXF_REF, sizeof(ref), &ref);
}
示例#25
0
/*
	uint32_t DecodeImage(uint32_t op_id, uint8_t* pSrc, uint32_t size, struct void* pStruct)
		
		op_id	- id of operation to perform from enum DecoderOps
		pSrc	- pointer to compressed file
		size    - size of available compressed file
		pStruct - pointer to ImageInfo or DecodeInfo struct depends on operation

		Return Value
		VM_DECODER_OK - success
		VM_DECODER_DECODE_FAILED - some error appears, maybe file corrupted or system haven't enough memory for decoder
		VM_DECODER_REACHED_MAX_THREADS - number of threads currently running by VM is reached their limit, wait a bit

*/
uint32_t SYSCALL SysDecodeImage(struct VirtualMachine* pVM)
{
	uint32_t id = pVM->Registers.r[0];

	switch(id){
		case VM_DECODER_GET_INFO:
		{
			struct UserFileStruct* pFile;
			struct ImageInfo* pImageInfo;
			uint32_t file_addr = pVM->Registers.r[1];
			uint32_t struct_addr = pVM->Registers.r[2];

			// check input structs
			if(((uint64_t)file_addr + sizeof(struct UserFileStruct)) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			if(((uint64_t)struct_addr + sizeof(struct ImageInfo)) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			// check buffers
			pFile = (struct UserFileStruct*)(pVM->pGlobalMemory + file_addr);
			if(((uint64_t)pFile->pBuf + pFile->buf_size) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			struct DecodeStruct* pInfo;
			pInfo = (struct DecodeStruct*)vm_malloc(sizeof(DecodeStruct));
			if(pInfo == NULL){
				assert(false);
				return VM_NOT_ENOUGH_MEMORY;
			}
			pImageInfo = (struct ImageInfo*)(pVM->pGlobalMemory + struct_addr);

			memset(pInfo, 0, sizeof(struct DecodeStruct));
			pInfo->pVM = pVM;
			pInfo->pFile = pFile;
			pInfo->pUser = (struct UserDecodeStruct*)pImageInfo;
			pInfo->pSrc = pVM->pGlobalMemory + pFile->pBuf;
			pInfo->src_size = pFile->buf_size;
			
			pVM->Registers.r[0] = GetImageInfo(pVM, pFile, pInfo, pImageInfo);
		}
		break;
		case VM_DECODE_JPEG:
		{
			struct UserFileStruct* pFile;
			struct UserDecodeStruct* pUserInfo;
			uint32_t file_addr = pVM->Registers.r[1];
			uint32_t addr = pVM->Registers.r[2];

			// check input structs
			if(((uint64_t)file_addr + sizeof(UserFileStruct)) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			if(((uint64_t)addr + sizeof(UserDecodeStruct)) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			// check buffers
			pFile = (struct UserFileStruct*)(pVM->pGlobalMemory + file_addr);
			if(((uint64_t)pFile->pBuf + pFile->buf_size) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			pUserInfo = (struct UserDecodeStruct*)(pVM->pGlobalMemory + addr);
			if(((uint64_t)pUserInfo->pDst + pUserInfo->dst_size) > pVM->GlobalMemorySize){
				assert(false);
				return VM_DATA_ACCESS_VIOLATION;
			}
			struct DecodeStruct* pInfo = (struct DecodeStruct*)vm_malloc(sizeof(DecodeStruct));
			if(pInfo == NULL){
				assert(false);
				return VM_NOT_ENOUGH_MEMORY;
			}
			memset(pInfo, 0, sizeof(struct DecodeStruct));
			pInfo->pVM = pVM;
			pInfo->pFile = pFile;
			pInfo->pUser = pUserInfo;
			pInfo->pSrc = pVM->pGlobalMemory + pFile->pBuf;
			pInfo->pDst = pVM->pGlobalMemory + pUserInfo->pDst;
			pInfo->src_size = pFile->buf_size;

			if(AddThread(pVM, DecodeJPEG, pInfo) != VM_OK){
				assert(false);
				pVM->Registers.r[0] = VM_DECODER_CANT_CREATE_THREAD;
			}
			pVM->Registers.r[0] = VM_DECODER_OK;
		}
		break;
		default:
			assert(false);
			return VM_INVALID_SYSCALL;		
	}

	return VM_OK;
}
示例#26
0
void printImageProperties( std::string path )
{
	try
	{

		Image         *image;
		ImageInfo     *image_info;
		
		// Read a file into image object
		image_info = AcquireImageInfo();
		GetImageInfo( image_info );

		strcpy( image_info -> filename, path.c_str() );

		ExceptionInfo* exceptionsInfo = AcquireExceptionInfo();
		GetExceptionInfo( exceptionsInfo );
		
		image = ReadImage( image_info, exceptionsInfo );
		
		std::string imageType;
		switch( image->type )
		{
			case UndefinedType             : imageType = "Undefined type of image"; break;
			case BilevelType               : imageType = "Bilevel image"; break;
			case GrayscaleType             : imageType = "Grayscale image"; break;
			case GrayscaleMatteType        : imageType = "Grayscale image with opacity"; break;
			case PaletteType               : imageType = "Indexed color image"; break;
			case PaletteMatteType          : imageType = "Indexed color image with opacity"; break;
			case TrueColorType             : imageType = "Truecolor image"; break;
			case TrueColorMatteType        : imageType = "Truecolor image with opacity"; break;
			case ColorSeparationType       : imageType = "Cyan/Yellow/Magenta/Black (CYMK) image"; break;
			case ColorSeparationMatteType  : imageType = "Cyan/Yellow/Magenta/Black (CYMK) image with opacity"; break;
			case OptimizeType              : imageType = "Optimize image"; break;
			case 11                        : imageType = "Indexed bilevel image with opacity"; break; // PaletteBilevelMatteType
		}

		std::string resolutionType;
		switch( image->units )
		{
			case UndefinedResolution            : resolutionType = " [unknown units]"; break;
			case PixelsPerInchResolution        : resolutionType = " [dpi]"; break;
			case PixelsPerCentimeterResolution  : resolutionType = " [pixels/cm]"; break;
		}

		std::string colorSpaceType;
		switch( image->colorspace )
		{
			case UndefinedColorspace      : colorSpaceType = "unknown color space"; break;
			case RGBColorspace            : colorSpaceType = "RGB"; break;
			case GRAYColorspace           : colorSpaceType = "Gray"; break;
			case TransparentColorspace    : colorSpaceType = "Transparent"; break;
			case OHTAColorspace           : colorSpaceType = "OHTA"; break;
			case XYZColorspace            : colorSpaceType = "XYZ"; break;
			case YCbCrColorspace          : colorSpaceType = "Y Cb Cr"; break;
			case YCCColorspace            : colorSpaceType = "YCC"; break;
			case YIQColorspace            : colorSpaceType = "YIQ"; break;
			case YPbPrColorspace          : colorSpaceType = "Y Pb Pr"; break;
			case YUVColorspace            : colorSpaceType = "YUV"; break;
			case CMYKColorspace           : colorSpaceType = "CMYK"; break;
			case sRGBColorspace           : colorSpaceType = "sRGB"; break;
			case LabColorspace            : colorSpaceType = "Lab"; break;
			case 14                       : colorSpaceType = "HSB"; break; // HSBColorspace
			case HSLColorspace            : colorSpaceType = "HSL"; break;
			case HWBColorspace            : colorSpaceType = "HWB"; break;
			case Rec601LumaColorspace     : colorSpaceType = "Rec601 Luma"; break;
			case 18                       : colorSpaceType = "Rec601 Y Cb Cr"; break; // Rec601YCbCrColorspace
			case Rec709LumaColorspace     : colorSpaceType = "Rec709 Luma"; break;
			case 20                       : colorSpaceType = "Rec709 Y Cb Cr"; break; //  Rec709YCbCrColorspace
			case LogColorspace            : colorSpaceType = "Log"; break;
			case 22                       : colorSpaceType = "CMY"; break; // CMYColorspace
		}

		std::string interlaceType;
		switch( image->interlace )
		{
			case UndefinedInterlace    : interlaceType = "undefined"; break;
			case NoInterlace           : interlaceType = "no interlacing"; break;
			case LineInterlace         : interlaceType = "line interlacing"; break;
			case PlaneInterlace        : interlaceType = "plane interlacing"; break;
			case PartitionInterlace    : interlaceType = "partition interlacing"; break;
			case 5                     : interlaceType = "GIF interlacing"; break; // GIFInterlace
			case 6                     : interlaceType = "Jpeg interlacing"; break; // JPEGInterlace
			case 7                     : interlaceType = "PNG interlacing"; break; // PNGInterlace
		}

		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "width"                 << image->columns                                                                         );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "height"                << image->rows                                                                            );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "bit-depth"             << image->depth  << " bits"                                                               );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "compression quality"   << image->quality                                                                         );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "image type"            << imageType                                                                              );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "" );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "x resolution"          << image->x_resolution  << resolutionType                                                 );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "y resolution"          << image->y_resolution  << resolutionType                                                 );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "interlacing"           << interlaceType                                                                          );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "" );
		//TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "format"                << image->format()                                                                        );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "channels"              << colorSpaceType << ( GetImageAlphaChannel(image)==MagickTrue ? std::string("A") : "" )  );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "color space"           << colorSpaceType                                                                         );
		TUTTLE_COUT( std::setw(FIRST_COLUMN_WIDTH) << "gamma"                 << image->gamma                                                                           );

		TUTTLE_COUT( "" );
	}
	catch( ... )
	{
		TUTTLE_COUT( "Caught exception" << "\n" );
	}
	
}