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:
- crop image while loading it. loaded cropped image.
- 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
Post a Comment