Sunday, May 6, 2012

Crop Image File Size, Width & Height Using Php Script

Crop Images Contextually

Crop images contextually for faster downloads and higher impact. By cropping maximally and resizing you can convey meaning without slowing down your web pages.

However, we've seen many sites that either use HTML's width and height attributes to resize larger images, or minimally crop and resize images to lose vital information. A better way to create images optimized for the Web is to crop them contextually.

Contextually Cropping


What is cropping contextually? Many times digital images shot for Web use have a border of useless space around the object(s) of interest. Rather than crop to just the film or chip's border, crop contextually down to the minimum dimensions that still convey the meaning or context of your image.
Note how the author is now more recognizable in the cropped version (behind the sunscreen) and the lettering is larger and more legible. Most importantly, the image has more impact, with the subject taking up more of the frame. This cropped image could be shown with a smaller dimension, saving file size.

Resize to a Smaller Thumbnail

Once you've got your image maximally cropped, resize and sharpen it to create a smaller thumbnail image. To give the reader more detail, you can provide a larger version (cropped or uncropped) of the image linked to that thumbnail.

This two-step process of cropping maximally and resizing is what Jakob Nielsen calls "relevance-enhanced image reduction." Nielsen writes that by combining cropping and scaling you can "preserve both content and detail, even at very small sizes." (Nielsen 2000)

Extreme Closeup for a Sneak Preview

Some high fashion sites actually use only the important part of an image as a thumbnail. For example, just the shoulder or neckline of a style - click and you get the full shots with details. This "image tease" technique can add an artistic feel to a site. Let's get up close and personal with our intrepid traveler.

Extreme Cropping through Rearrangement

In extreme cases you could rearrange the target objects and reshoot, or move them closer together in your favorite image editing program. The idea is to use the smallest possible image that still conveys the information you want to display. You may need to bump up font sizes to withstand more extreme image reductions.

JPEG Cropping Caution

Be careful when resaving JPEG images. Reoptimizing an existing JPEG can compound compression artifacts. It is possible to transform JPEGs losslessly, however. Lossless transformations (like 90-degree rotations and flips) require the dimensions of the JPEG to be a multiple of the block size (16x16, 16x8, or 8x8 pixels for color JPEGs). Lossless crops are also possible by cropping to block boundaries with specialized software, like JPEG Wizard.

1 comment:

  1. I'm on the fence about this, while more customization is good, I have a feeling this is a "in-progress" update, it just feels incomplete and half-way there.
    We use badge layout for apps on design approvals (visual projects), so the image being displayed is important. Old layout "feels like" it had larger images,
    maybe because the images were cropped more loosely so it's easier to tell which project it was at quick glance. Now the image is cropped closer, making it
    harder to scan thru at quick glance. I find myself needing to click into the project more often than usual. Which makes the whole user experience less
    efficient.
    I have a couple suggestions that might make it work better:
    1. Increase the height of the window the cover image is being displayed.
    2. Let us to choose which image to be displayed as "cover" (like how Pinterest handles cover images of each board, was hoping for this for a long time)
    3. Let us adjust which part of the image to show and how tight or loose the crop is (with a fixed window, let us move the image around and maybe enlarge or
    shrink it to control what shows thru the window. Pinterest does a limited form of this, which is very useful in making the cover image relevant)
    4. Allow Cover Image to be ordered in different hierarchy (currently every element can be ordered differently except the Cover Image, it seems to be stuck
    in the 2nd spot, would like the option to set it on another spot in the layout. This one seems like an easy fix, since you guys allow that for every other
    element already)

    ReplyDelete