Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the hash (#) resize option in ImageMagick?

Just came across this resize option '300x300#' and is wondering what the hash option means? There seems to be nothing on this option in the official ImageMagick documentation.

like image 402
user2012434 Avatar asked Jan 31 '14 01:01

user2012434


People also ask

What do you mean by hash?

Hashing is the process of transforming any given key or a string of characters into another value. This is usually represented by a shorter, fixed-length value or key that represents and makes it easier to find or employ the original string. The most popular use for hashing is the implementation of hash tables.

What is the hash in crypto?

A hash is a function that meets the encrypted demands needed to solve for a blockchain computation. Hashes are of a fixed length since it makes it nearly impossible to guess the length of the hash if someone was trying to crack the blockchain. The same data will always produce the same hashed value.

What is purpose of hash?

Hashing is a cryptographic process that can be used to validate the authenticity and integrity of various types of input. It is widely used in authentication systems to avoid storing plaintext passwords in databases, but is also used to validate files, documents and other types of data.

What is an example of a hash?

Hashing is an important data structure designed to solve the problem of efficiently finding and storing data in an array. For example, if you have a list of 20000 numbers, and you have given a number to search in that list- you will scan each number in the list until you find a match.


1 Answers

According to Paperclip's API documentation:

Paperclip also adds the “#” option (e.g. “50x50#”), which will resize the image to fit maximally inside the dimensions and then crop the rest off (weighted at the center).

So, if you upload a 120x100 image and crop to "50x50#", it'll resize the image to 60x50, and then crop 50x50 using the image's centroid as the anchor (thereby removing 5px from the left and 5px from the right).

like image 140
Jacob Budin Avatar answered Sep 20 '22 05:09

Jacob Budin