original_string: public final function contract( int $percent, bool $internal = true )
        : IImage
     {
  
        if ( $percent < 1 || $percent >= 100 )
        {
           throw new ArgumentError(
              'percent',
              $percent,
              'Drawing.Image',
              'Image dimension contraction must produce a smaller, non zero sized image!'
           );
        }
  
        $newWidth  = \intval( \floor( $this->getWidth()  * $percent / 100 ) );
        $newHeight = \intval( \floor( $this->getHeight() * $percent / 100 ) );
  
        if ( $this->isTrueColor() )
        {
           $dst = \imagecreatetruecolor( $newWidth, $newHeight );
        }
        else
        {
           $dst = \imagecreate( $newWidth, $newHeight );
        }
  
        if ( $this->canUseTransparency() )
        {
           \imagealphablending( $dst, false );
           \imagesavealpha( $dst, true );
        }
  
        \imagecopyresized( $dst, $this->r, 0, 0, 0, 0, $newWidth, $newHeight, $this->getWidth(), $this->getHeight() );
  
        if ( $internal )
        {
           if ( ! \is_null( $this->r ) )
           {
              \imagedestroy( $this->r );
              $this->r = null;
           }
           $this->r = $dst;
           $this->size->setWidth( $newWidth );
           $this->size->setHeight( $newHeight );
           return $this;
        }
  
        return new GdImage(
           $dst,
           new Size( $newWidth, $newHeight ),
           $this->mimeType,
           $this->_file
        );
  
     }
code: public final function contract( int $percent, bool $internal = true )
        : IImage
     {
  
        if ( $percent < 1 || $percent >= 100 )
        {
           throw new ArgumentError(
              'percent',
              $percent,
              'Drawing.Image',
              'Image dimension contraction must produce a smaller, non zero sized image!'
           );
        }
  
        $newWidth  = \intval( \floor( $this->getWidth()  * $percent / 100 ) );
        $newHeight = \intval( \floor( $this->getHeight() * $percent / 100 ) );
  
        if ( $this->isTrueColor() )
        {
           $dst = \imagecreatetruecolor( $newWidth, $newHeight );
        }
        else
        {
           $dst = \imagecreate( $newWidth, $newHeight );
        }
  
        if ( $this->canUseTransparency() )
        {
           \imagealphablending( $dst, false );
           \imagesavealpha( $dst, true );
        }
  
        \imagecopyresized( $dst, $this->r, 0, 0, 0, 0, $newWidth, $newHeight, $this->getWidth(), $this->getHeight() );
  
        if ( $internal )
        {
           if ( ! \is_null( $this->r ) )
           {
              \imagedestroy( $this->r );
              $this->r = null;
           }
           $this->r = $dst;
           $this->size->setWidth( $newWidth );
           $this->size->setHeight( $newHeight );
           return $this;
        }
  
        return new GdImage(
           $dst,
           new Size( $newWidth, $newHeight ),
           $this->mimeType,
           $this->_file
        );
  
     }
code_tokens: public final function contract ( int $ percent , bool $ internal = true ) : IImage { if ( $ percent < 1 || $ percent >= 100 ) { throw new ArgumentError ( 'percent' , $ percent , 'Drawing.Image' , 'Image dimension contraction must produce a smaller, non zero sized image!' ) ; } $ newWidth = \ intval ( \ floor ( $ this -> getWidth ( ) * $ percent / 100 ) ) ; $ newHeight = \ intval ( \ floor ( $ this -> getHeight ( ) * $ percent / 100 ) ) ; if ( $ this -> isTrueColor ( ) ) { $ dst = \ imagecreatetruecolor ( $ newWidth , $ newHeight ) ; } else { $ dst = \ imagecreate ( $ newWidth , $ newHeight ) ; } if ( $ this -> canUseTransparency ( ) ) { \ imagealphablending ( $ dst , false ) ; \ imagesavealpha ( $ dst , true ) ; } \ imagecopyresized ( $ dst , $ this -> r , 0 , 0 , 0 , 0 , $ newWidth , $ newHeight , $ this -> getWidth ( ) , $ this -> getHeight ( ) ) ; if ( $ internal ) { if ( ! \ is_null ( $ this -> r ) ) { \ imagedestroy ( $ this -> r ) ; $ this -> r = null ; } $ this -> r = $ dst ; $ this -> size -> setWidth ( $ newWidth ) ; $ this -> size -> setHeight ( $ newHeight ) ; return $ this ; } return new GdImage ( $ dst , new Size ( $ newWidth , $ newHeight ) , $ this -> mimeType , $ this -> _file ) ; }
docstring: Reduce the original image size by the specified percentage value.
  
  @param  int  $percent The percentage value.
  @param  bool $internal Do not create a new instance?
  @return \Beluga\Drawing\Image\IImage
  @throws \Beluga\ArgumentError If $percent is lower than 1 oder greater than 99.
docstring_tokens: Reduce the original image size by the specified percentage value .