You specify the size of images using ImageMagick's Geometry syntax which can be a little confusing. Here are the aspects of that which are most useful for Paperclip users.
The basic specification is <width>x<height> in pixels, optionally followed by a modifier. In some cases you can omit either width or height.
- 256x256
- 256x256!
- 256x
- x256
- 256x256^
- 256x256>
- 256x256<
This specifies the Maximum dimensions for the image, while preserving the aspect ratio of the image. So if your image were actually 512x256 it would be resized to 256x128 in order to fit inside the specified size.
This specifies the Exact image size, so a 512x256 image would be changed into 256x256, losing the aspect ratio.
This specifies the desired width of the target image, leaving the height to be set so as to preserve the aspect ratio.
This specifies the desired height of the target image, while preserving the aspect ratio.
This specifies the Minimum size for the target image, so the resized image may be larger than these dimensions.
This specifies that the image will be resized only if it is Larger than the dimensions.
This specifies that the image will be resized only if it is Smaller than the dimensions.
Other options exist within the syntax. See the ImageMagick docs for more details.
1 comment:
useful, thanks :)
Post a Comment