[whatwg] Wish: Restrict Image Size on Upload

On Mon, 27 Dec 2004, Greg Kilwein wrote:
> Ian Hickson wrote:
> > On Mon, 27 Dec 2004 what at keepthebyte.ch wrote:
> >  
> > > It would be useful to be able to define a bounding box of allowed 
> > > picture width and height when uploading picture(s). The UA would 
> > > need to check if the selected picture(s) is/are inside the allowed 
> > > range (min - max width & height). With picture I generally mean the 
> > > internet widespread formats (png, gif, jpg).
> > 
> > With the coming of high-resolution monitors, the pixel size of the 
> > image will presumably become less important, as monitors will be 
> > getting more pixels per centimeter.
>
> I disagree.  Displaying an image on a high resolution monitor is a 
> different issue than controlling the number of pixels that the image may 
> contain.  A given device (screen, printer, PDA, projector, or other 
> media) may scale an image's pixels as necessary for optimal viewing.  
> Most UAs have some sort of pixel scaling that occurs when an HTML 
> document is printed.  For example, I find that an image that is 
> approximately 700 by 600 pixels will print nicely on a single page in 
> Internet Explorer for the majority of users with a variety of margin 
> settings.  This makes pixel size very relevant when the exact image 
> dimensions are unknown, so images over a certain size could be 
> disallowed if the page is to be printed.  It's possible to do this now 
> with some server-side image manipulation, but would be nice to have 
> inside UAs.  Ideally, there would be the ability to provide hints to the 
> UA so it could resize the image upon upload, rather than just displaying 
> an error message.

On the contrary, IMHO printing illustrates my point quite well. A 700x600 
pixel image will take the same physical size on the paper as a 7000x6000 
pixel image, if given an appropriate stylesheet -- the difference is that 
the second one will be of significantly higher quality.


> Why would a high resolution monitor make the pixel size less important?

Because 1px on the screen will contain more than one physical pixel, and 
so an image can have more physical pixels than its final dimensions in CSS 
pixels. You can see this today when printing -- 16px text when printed 
uses a lot more than 16 physical dots.


> Presumably, the pixel size would remain important, since the sharpest 
> images would be those that match the pixel resolution of the monitor.  
> Pixel scaling of any kind on a monitor typically results in reduced 
> image quality, either by means of pixelation or aliasing.

But the author cannot in general make any assumptions about the resolution 
of the device the user is using to access the image.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 6 January 2005 09:18:31 UTC