get special offset for class

@param  \Imagick $original
@param  int      $targetWidth
@param  int      $targetHeight
@return array
515042
protected function getSpecialOffset(\Imagick $original, $targetWidth, $targetHeight)
    {
        return $this->getRandomEdgeOffset($original, $targetWidth, $targetHeight);
    }
636796
public function setOriginSize($originWidth, $originHeight)
    {
        $this->originWidth = $originWidth;
        $this->originHeight = $originHeight;

        return $this;
    }
156031
@NonNull
  public RequestCreator resizeDimen(int targetWidthResId, int targetHeightResId) {
    Resources resources = picasso.context.getResources();
    int targetWidth = resources.getDimensionPixelSize(targetWidthResId);
    int targetHeight = resources.getDimensionPixelSize(targetHeightResId);
    return resize(targetWidth, targetHeight);
  }
849443
protected function doResize($bg, $target_width, $target_height, $new_width, $new_height)
    {
        $width = $this->width();
        $height = $this->height();
        $n = imagecreatetruecolor($target_width, $target_height);

        if ($bg != 'transparent') {
            imagefill($n, 0, 0, ImageColor::gdAllocate($this->resource, $bg));
        } else {
            imagealphablending($n, false);
            $color = ImageColor::gdAllocate($this->resource, 'transparent');

            imagefill($n, 0, 0, $color);
            imagesavealpha($n, true);
        }

        imagecopyresampled($n, $this->resource, ($target_width - $new_width) / 2, ($target_height - $new_height) / 2, 0, 0, $new_width, $new_height, $width, $height);
        imagedestroy($this->resource);

        $this->resource = $n;

        return $this;
    }
1181232
protected function getTargetDimensions($width, $height, $originalImagePath)
    {
        $originalDimensions = [$width, $height];

        try {
            $dimensions = getimagesize($originalImagePath);
            if (!$dimensions) {
                return $originalDimensions;
            }

            if ($dimensions[0] > $width || $dimensions[1] > $height) {
                return $originalDimensions;
            }

            return $dimensions;
        }
        catch (Exception $ex) {
            return $originalDimensions;
        }
    }
804405
private function getAbstractProxiedMethods(ReflectionClass $originalClass) : array
    {
        return array_map(
            static function (ReflectionMethod $method) : ProxyManagerMethodGenerator {
                $generated = ProxyManagerMethodGenerator::fromReflectionWithoutBodyAndDocBlock(
                    new MethodReflection($method->getDeclaringClass()->getName(), $method->getName())
                );

                $generated->setAbstract(false);

                return $generated;
            },
            ProxiedMethodsFilter::getAbstractProxiedMethods($originalClass)
        );
    }
1090897
private function getTargetSize($originalWidth, $originalHeight, $targetWidth, $targetHeight)
    {
        if ($targetWidth === null) {
            return $this->resizeByHeight($originalWidth, $originalHeight, $targetHeight);
        }

        if ($targetHeight === null) {
            return $this->resizeByWidth($originalWidth, $originalHeight, $targetWidth);
        }

        $diffWidth = $originalWidth / $targetWidth;
        $diffHeight = $originalHeight / $targetHeight;

        if ($diffWidth <= $diffHeight) {
            return $this->resizeByHeight($originalWidth, $originalHeight, $targetHeight);
        }

        if ($diffWidth > $diffHeight) {
            return $this->resizeByWidth($originalWidth, $originalHeight, $targetWidth);
        }
    }
177976
protected function redirectAddAllRemainingInGlobalGet (& $targetUrl) {
		if ($this->requestGlobalGet) {
			$amp = $this->getQueryStringParamsSepatator();
			//foreach ($this->requestGlobalGet as $paramName => & $paramValue)
			//	$paramValue = rawurldecode($paramValue);
			$questionMarkDelimiter = mb_strpos($targetUrl, '?') === FALSE ? '?' : $amp;
			$targetUrl .= $questionMarkDelimiter . str_replace(
				'%2F', '/', 
				http_build_query($this->requestGlobalGet, '', $amp, PHP_QUERY_RFC3986)
			);
		}
	}
593271
public static <T extends ImageGray<T>> T checkReshape(T target , ImageGray testImage , Class<T> targetType )
	{
		if( target == null ) {
			return GeneralizedImageOps.createSingleBand(targetType, testImage.width, testImage.height);
		} else if( target.width != testImage.width || target.height != testImage.height ) {
			target.reshape(testImage.width,testImage.height);
		}
		return  target;
	}
926589
public function fitHeight(&$source, $target, array $action)
    {
        $height = reset($action['value']);

        if ($this->image->set($source)->fitToHeight($height)->save($target)) {
            $source = $target;
            return true;
        }

        return false;
    }
644463
public function cropFromEdge($cropWidth, $cropHeight = null, $edge = 0)
        {
            if ($cropHeight === null) {
                $cropHeight = $cropWidth;
            }

            $cropWidth = ($this->_sourceWidth < $cropWidth) ? $this->_sourceWidth:$cropWidth;
            $cropHeight = ($this->_sourceHeight < $cropHeight) ? $this->_sourceHeight:$cropHeight;

            $cropX = intval(($this->_sourceWidth - $cropWidth) / 2);
            $cropY = intval(($this->_sourceHeight - $cropHeight) / 2);

            $top = (int) $edge | 12;
            if (14 == $top) {
                $cropY = 0;
            } elseif (13 == $top) {
                $cropY = $this->_sourceHeight - $cropHeight;
            }

            $left = ($edge >> 2);
            if (2 == $left) {
                $cropX = 0;
            } elseif (1 == $left) {
                $cropX = $this->_sourceWidth - $cropWidth;
            }

            return $this->crop($cropX, $cropY, $cropWidth, $cropHeight);
        }
530986
private function getOptimalCrop($newWidth, $newHeight)
		# Author:     Jarrod Oberto
		# Date:       17-11-09
		# Purpose:    Get optimal crop dimensions
		# Param in:   width and height as requested by user (fig 3)
		# Param out:  Array of optimal width and height (fig 2)
		# Reference:
		# Notes:      The optimal width and height return are not the same as the
		#       same as the width and height passed in. For example:
		#
		#
		#   |-----------------|     |------------|       |-------|
		#   |             |   =>  |**|      |**|   =>  |       |
		#   |             |     |**|      |**|       |       |
		#   |           |       |------------|       |-------|
		#   |-----------------|
		#        original                optimal             crop
		#              size                   size               size
		#  Fig          1                      2                  3
		#
		#       300 x 250           150 x 125          150 x 100
		#
		#    The optimal size is the smallest size (that is closest to the crop size)
		#    while retaining proportion/ratio.
		#
		#  The crop size is the optimal size that has been cropped on one axis to
		#  make the image the exact size specified by the user.
		#
		#               * represent cropped area
		#
	{

		// *** If forcing is off...
		if ( ! $this->forceStretch)
		{

			// *** ...check if actual size is less than target size
			if ($this->width < $newWidth && $this->height < $newHeight)
			{
				return array( 'optimalWidth' => $this->width, 'optimalHeight' => $this->height );
			}
		}

		$heightRatio = $this->height / $newHeight;
		$widthRatio = $this->width / $newWidth;

		if ($heightRatio < $widthRatio)
		{
			$optimalRatio = $heightRatio;
		}
		else
		{
			$optimalRatio = $widthRatio;
		}

		$optimalHeight = round($this->height / $optimalRatio);
		$optimalWidth = round($this->width / $optimalRatio);

		return array( 'optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight );
	}
1124076
private int getResultingTargetWidth() {

        int width = -1;
        if ((m_targetHeight > -1) || (m_targetWidth > -1)) {
            if (m_targetWidth > -1) {
                width = m_targetWidth;
            } else {
                width = (int)Math.floor(((1.00 * m_orgWidth) / m_orgHeight) * m_targetHeight);
            }
        }
        return width;
    }
447130
function getTargetName($includeHash = true)
    {
        $target = $this->getBasename(false);

        if ($includeHash) {
            $target .= '-' . $this->getDigest();
        }

        $target .= $this->getFormatExtension();

        return $target;
    }
342614
public function transformImage($originalImageHtml, array $attributesFilters = [])
    {
        $dom = new \DOMDocument();

        // mute "htmlParseEntityRef: no name in Entity" warning generated by & and &amp;
        @$dom->loadHTML('<?xml encoding="utf-8"?>'.$originalImageHtml);
        if (0 === $dom->getElementsByTagName('img')->length) {
            throw new TransformationException(sprintf('Unable to parse img element: %s', $originalImageHtml));
        }

        $image = $dom->getElementsByTagName('img')->item(0);

        // apply the specified filters
        $originalImageUrl = $image->hasAttribute('src') ? trim($image->getAttribute('src')) : null;
        $processedAttributes = [];
        if (!empty($originalImageUrl) && false === strpos($originalImageUrl, 'data:image/')) {
            try {
                $elementFilters = $attributesFilters;

                // consider html 'width' and 'height' attributes for filter generation
                if (isset($elementFilters['src']) && is_array($elementFilters['src'])) {
                    if ($image->hasAttribute('width') && '' !== $image->getAttribute('width')) {
                        $elementFilters['src']['w'] = $image->getAttribute('width');
                    }
                    if ($image->hasAttribute('height') && '' !== $image->getAttribute('height')) {
                        $elementFilters['src']['h'] = $image->getAttribute('height');
                    }
                }

                foreach ($elementFilters as $attributeName => $filters) {
                    $attributeValue = $this->attributeGenerator->generateAttributeValue($originalImageUrl, $filters);
                    if ('' !== $attributeValue) {
                        $image->setAttribute($attributeName, $attributeValue);
                        $processedAttributes[] = $attributeName;
                    }
                }
            } catch (ResolutionException $e) {
            }
        }

        // apply the cdn domain on the remaining attributes
        foreach ($image->attributes as $attribute) {
            if (!in_array($attribute->name, $processedAttributes)) {
                $this->applyCdnDomain($attribute);
            }
        }

        return $this->renderer->render($image);
    }
846649
private function getMinTargetSize($w, $h)
    {
        extract($this->getInfo());

        if ($w > $width or $h > $height) {
            $w = $width;
            $h = $height;
        }

        if ($w > $h) {
            extract($this->getFilesize($w, 0));
        } else {
            extract($this->getFilesize(0, $h));
        }

        $this->targetSize = compact('width', 'height');
    }
958233
private function getSizeInSameRatio($size1, $size2, $originalSize)
    {
        if ($size1) {
            $size1 = $size1 / $size2 * $originalSize;
        }

        $size2 = $originalSize;

        if ($size1 < 1) {
            $size1 = 1;
        }
        if ($size2 < 1) {
            $size2 = 1;
        }

        return [$size1, $size2];
    }