php - Fastest way to extract a crop from a JPEG file on demand? -


users on website can click portion of photo closeup of it.

i have bit of javascript fires off ajax call php script uses imagemagick retrieve relevant crop.

could doing better, outside of php? using imagemagick directly somehow, or else?

currently files reside on same server main website, due space restraints i'm in process of moving them separate server, need make call between 2 somehow.

the photos vary in size, 1600x1200 , 200kb, others 24mp+ 20mb+ originals.

using imagemagick, have 2 options:

  1. crop image while loading it. loaded cropped image.
  2. load image, crop it. loaded complete image.

the first method more efficient , faster.

this method append image area information to input image(s) in square brackets ([...]) this:

convert wizard:[130x150+80+80] -resize 200% wiz-head.png 

this crop piece of 130x150 pixels offset of 80 pixels top left corner of original, built-in wizard: image. here both images side side, wizard: (left) , cropped section, resized 200%:

if wanted crop jpeg, you'd use like:

   convert some.jpeg[330x250+180+280] -resize 300% output.png 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -