Problem with percentage-based image cropping

Yet another thing that came up while implementing: percentage-based  
cropping has a problem if it isn't done on the server, unless the  
server reports back all relevant information (original size and  
cropped size) to the client.

Assume we have a crop of 25%, 25%, 50%, 50%, i.e. the middle 320x240  
pixels of a 640x480 picture.

If the server returns the original image there is no problem: we can  
do the cropping client side. The only thing required is that the  
server somehow indicates that it hasn't done the cropping for us  
(possibly by being completely silent on the issue).

If the server does do the exact cropping we requested it could either  
tell the client "Don't worry, all cropping has been done". But if the  
server wants the freedom to do partial cropping (for example because  
if wants to do cropping without transcoding) it must tell the client  
both the original (w, h) and the cropped (x, y, cropped_w, cropped_h).  
Otherwise the client can't do the calculations to compute the  
(pixel_x, pixel_y, pixel_w, pixel_h) coordinates.

--
Jack Jansen, <Jack.Jansen@cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman

Received on Monday, 30 March 2009 12:50:29 UTC